diff --git a/app/views/posts/show.haml b/app/views/posts/show.haml index 32f3951..1c0324a 100644 --- a/app/views/posts/show.haml +++ b/app/views/posts/show.haml @@ -25,8 +25,8 @@ .row .col .content{class: @post.get_front_matter(:dir)} - :markdown - #{@post.content} + = sanitized_markdown @post.content, + tags: %w[h1 h2 h3 h4 h5 h6 p a ul ol li table tr td th tbody thead tfoot em strong sup blockquote cite pre] -# Representar los datos en una tabla: -# Texto: tal cual en una celda @@ -73,8 +73,8 @@ %td= v - elsif data.respond_to? :content -# Contenido del artículo - :markdown - #{data.content} + = sanitized_markdown data.content, + tags: %w[h1 h2 h3 h4 h5 h6 p a ul ol li table tr td th tbody thead tfoot em strong sup blockquote cite pre] - elsif data.respond_to? :strftime -# Fecha = data.strftime('%F') diff --git a/config/initializers/commonmarker.rb b/config/initializers/commonmarker.rb deleted file mode 100644 index 4d6743f..0000000 --- a/config/initializers/commonmarker.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -require 'commonmarker' - -module Haml::Filters - remove_filter('Markdown') # remove the existing Markdown filter - - module Markdown - include Haml::Filters::Base - - def render(text) - CommonMarker.render_html(text, - [:TABLE_PREFER_STYLE_ATTRIBUTES], - %i[table strikethrough autolink tagfilter]) - end - end -end