mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-22 13:46:20 +00:00
soportar contenido en markdown
This commit is contained in:
parent
070ef62806
commit
17a248260f
1 changed files with 8 additions and 1 deletions
|
@ -8,7 +8,7 @@ class MetadataContent < MetadataTemplate
|
|||
end
|
||||
|
||||
def value
|
||||
self[:value] || document.content || default_value
|
||||
self[:value] || legacy_content || default_value
|
||||
end
|
||||
|
||||
def front_matter?
|
||||
|
@ -17,6 +17,13 @@ class MetadataContent < MetadataTemplate
|
|||
|
||||
private
|
||||
|
||||
# Detectar si el contenido estaba en Markdown y pasarlo a HTML
|
||||
def legacy_content
|
||||
return document.content if /^\s*</ =~ document.content
|
||||
|
||||
CommonMarker.render_doc(document.content, %i[FOOTNOTES SMART], %i[table strikethrough autolink]).to_html
|
||||
end
|
||||
|
||||
# Limpiar el HTML que recibimos
|
||||
#
|
||||
# TODO: En lugar de comprobar el Content Type acá, restringir los
|
||||
|
|
Loading…
Reference in a new issue