campo de markdown
This commit is contained in:
parent
00fafc2e84
commit
4aba16d450
3 changed files with 21 additions and 13 deletions
|
@ -1,3 +1,17 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class MetadataMarkdown < MetadataText; end
|
||||
# Markdown
|
||||
class MetadataMarkdown < MetadataText
|
||||
# Renderizar a HTML y sanitizar
|
||||
def to_s
|
||||
sanitize CommonMarker.render_doc(value, %i[FOOTNOTES SMART],
|
||||
%i[table strikethrough autolink]).to_html
|
||||
end
|
||||
|
||||
# XXX: No sanitizamos acá porque se escapan varios símbolos de
|
||||
# markdown y se eliminan autolinks. Mejor es habilitar la generación
|
||||
# SAFE de CommonMark en la configuración del sitio.
|
||||
def sanitize(string)
|
||||
string
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,17 +1,8 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
# Contenido con el editor de Markdown
|
||||
class MetadataMarkdownContent < MetadataContent
|
||||
# Renderizar a HTML y sanitizar
|
||||
def to_s
|
||||
sanitize CommonMarker.render_doc(value, %i[FOOTNOTES SMART],
|
||||
%i[table strikethrough autolink]).to_html
|
||||
end
|
||||
|
||||
# XXX: No sanitizamos acá porque se escapan varios símbolos de
|
||||
# markdown y se eliminan autolinks. Mejor es habilitar la generación
|
||||
# SAFE de CommonMark en la configuración del sitio.
|
||||
def sanitize(string)
|
||||
string
|
||||
class MetadataMarkdownContent < MetadataMarkdown
|
||||
def front_matter?
|
||||
false
|
||||
end
|
||||
end
|
||||
|
|
3
app/views/posts/attribute_ro/_markdown.haml
Normal file
3
app/views/posts/attribute_ro/_markdown.haml
Normal file
|
@ -0,0 +1,3 @@
|
|||
%tr{ id: attribute }
|
||||
%th= post_label_t(attribute, post: post)
|
||||
%td{ lang: locale, dir: dir }= metadata.value.to_s.html_safe
|
Loading…
Reference in a new issue