mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-23 01:16:21 +00:00
no mezclar markdown con html
This commit is contained in:
parent
c006ed7f29
commit
f73e6ecb6f
1 changed files with 13 additions and 1 deletions
|
@ -1,13 +1,25 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
# Contenido con el editor de Markdown
|
||||
class MetadataMarkdownContent < MetadataContent
|
||||
class MetadataMarkdownContent < MetadataText
|
||||
# Renderizar a HTML y sanitizar
|
||||
def to_s
|
||||
sanitize CommonMarker.render_doc(value, %i[FOOTNOTES SMART],
|
||||
%i[table strikethrough autolink]).to_html
|
||||
end
|
||||
|
||||
def value
|
||||
self[:value] || value_from_document || default_value
|
||||
end
|
||||
|
||||
def front_matter?
|
||||
false
|
||||
end
|
||||
|
||||
def value_from_document
|
||||
document.content
|
||||
end
|
||||
|
||||
# XXX: No sanitizamos acá porque se escapan varios símbolos de
|
||||
# markdown y se eliminan autolinks. Mejor es deshabilitar la
|
||||
# generación SAFE de CommonMark en la configuración del sitio.
|
||||
|
|
Loading…
Reference in a new issue