From bd3a19de1467762f941e7250061c29a57429316b Mon Sep 17 00:00:00 2001 From: f Date: Fri, 23 Feb 2018 16:12:39 -0300 Subject: [PATCH] usar commonmarker closes #34 --- Gemfile | 1 + Gemfile.lock | 5 +++++ config/initializers/commonmarker.rb | 18 ++++++++++++++++++ 3 files changed, 24 insertions(+) create mode 100644 config/initializers/commonmarker.rb diff --git a/Gemfile b/Gemfile index c8ff1251..4a62fcd5 100644 --- a/Gemfile +++ b/Gemfile @@ -30,6 +30,7 @@ gem 'jbuilder', '~> 2.5' # Use Capistrano for deployment # gem 'capistrano-rails', group: :development +gem 'commonmarker' gem 'email_address' gem 'rails_warden' gem 'haml-rails' diff --git a/Gemfile.lock b/Gemfile.lock index b883fffd..96470780 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -80,6 +80,8 @@ GEM chronic (0.10.2) coderay (1.1.2) colorator (1.1.0) + commonmarker (0.17.8) + ruby-enum (~> 0.5) concurrent-ruby (1.0.5) crass (1.0.3) dotenv (2.2.1) @@ -213,6 +215,8 @@ GEM rbnacl (4.0.2) ffi rouge (3.1.0) + ruby-enum (0.7.2) + i18n ruby_dep (1.5.0) ruby_parser (3.10.1) sexp_processor (~> 4.9) @@ -288,6 +292,7 @@ DEPENDENCIES capistrano-rails capistrano-rbenv capybara (~> 2.13) + commonmarker dotenv-rails email_address exception_notification diff --git a/config/initializers/commonmarker.rb b/config/initializers/commonmarker.rb new file mode 100644 index 00000000..4f98c687 --- /dev/null +++ b/config/initializers/commonmarker.rb @@ -0,0 +1,18 @@ +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], + [:table,:strikethrough,:autolink,:tagfilter]) + end + + end +end