2020-05-26 22:26:19 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2020-06-24 20:48:16 +00:00
|
|
|
# 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)
|
2022-04-04 16:56:40 +00:00
|
|
|
string.unicode_normalize(:nfkc)
|
2020-06-24 20:48:16 +00:00
|
|
|
end
|
|
|
|
end
|