From 59ab20b887e34d99e04b10a57e7531cb767144bd Mon Sep 17 00:00:00 2001 From: f Date: Sat, 27 Jul 2019 12:25:05 -0300 Subject: [PATCH] el filtro de commonmark para haml arroja un error --- app/views/posts/show.haml | 8 ++++---- config/initializers/commonmarker.rb | 17 ----------------- 2 files changed, 4 insertions(+), 21 deletions(-) delete mode 100644 config/initializers/commonmarker.rb diff --git a/app/views/posts/show.haml b/app/views/posts/show.haml index 32f3951f..1c0324ad 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 4d6743fe..00000000 --- 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