5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-07-02 12:36:08 +00:00

soportar contenido en markdown

This commit is contained in:
f 2021-02-24 16:57:20 -03:00
parent 070ef62806
commit 17a248260f

View file

@ -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