diff --git a/gemfiles/rails_5.gemfile.lock b/gemfiles/rails_5.gemfile.lock index d923ae0..769ab56 100644 --- a/gemfiles/rails_5.gemfile.lock +++ b/gemfiles/rails_5.gemfile.lock @@ -3,7 +3,7 @@ PATH specs: maildown (3.1.0) actionmailer (>= 4.0.0) - kramdown + kramdown-parser-gfm GEM remote: https://rubygems.org/ @@ -58,10 +58,16 @@ GEM activesupport (>= 4.2.0) i18n (1.6.0) concurrent-ruby (~> 1.0) - kramdown (2.1.0) + kramdown (2.2.1) + rexml + kramdown-parser-gfm (1.1.0) + kramdown (~> 2.0) loofah (2.2.3) crass (~> 1.0.2) nokogiri (>= 1.5.9) + m (1.5.1) + method_source (>= 0.6.7) + rake (>= 0.9.2.2) mail (2.7.1) mini_mime (>= 0.1.1) method_source (0.9.2) @@ -98,6 +104,7 @@ GEM rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) rake (12.3.2) + rexml (3.2.4) sprockets (3.7.2) concurrent-ruby (~> 1.0) rack (> 1, < 3) @@ -119,6 +126,7 @@ PLATFORMS DEPENDENCIES appraisal + m maildown! rails (= 5.0.7.2) railties @@ -126,4 +134,4 @@ DEPENDENCIES sqlite3 (~> 1.3.6) BUNDLED WITH - 2.0.2 + 2.1.4 diff --git a/gemfiles/rails_51.gemfile.lock b/gemfiles/rails_51.gemfile.lock index 20a4950..cdab2d4 100644 --- a/gemfiles/rails_51.gemfile.lock +++ b/gemfiles/rails_51.gemfile.lock @@ -3,7 +3,7 @@ PATH specs: maildown (3.1.0) actionmailer (>= 4.0.0) - kramdown + kramdown-parser-gfm GEM remote: https://rubygems.org/ @@ -58,10 +58,16 @@ GEM activesupport (>= 4.2.0) i18n (1.6.0) concurrent-ruby (~> 1.0) - kramdown (2.1.0) + kramdown (2.2.1) + rexml + kramdown-parser-gfm (1.1.0) + kramdown (~> 2.0) loofah (2.2.3) crass (~> 1.0.2) nokogiri (>= 1.5.9) + m (1.5.1) + method_source (>= 0.6.7) + rake (>= 0.9.2.2) mail (2.7.1) mini_mime (>= 0.1.1) method_source (0.9.2) @@ -98,6 +104,7 @@ GEM rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) rake (12.3.2) + rexml (3.2.4) sprockets (3.7.2) concurrent-ruby (~> 1.0) rack (> 1, < 3) @@ -119,6 +126,7 @@ PLATFORMS DEPENDENCIES appraisal + m maildown! rails (= 5.1.7) railties @@ -126,4 +134,4 @@ DEPENDENCIES sqlite3 (~> 1.3.6) BUNDLED WITH - 2.0.2 + 2.1.4 diff --git a/gemfiles/rails_52.gemfile.lock b/gemfiles/rails_52.gemfile.lock index faa7fe2..fe4653a 100644 --- a/gemfiles/rails_52.gemfile.lock +++ b/gemfiles/rails_52.gemfile.lock @@ -3,7 +3,7 @@ PATH specs: maildown (3.1.0) actionmailer (>= 4.0.0) - kramdown + kramdown-parser-gfm GEM remote: https://rubygems.org/ @@ -62,10 +62,16 @@ GEM activesupport (>= 4.2.0) i18n (1.6.0) concurrent-ruby (~> 1.0) - kramdown (2.1.0) + kramdown (2.2.1) + rexml + kramdown-parser-gfm (1.1.0) + kramdown (~> 2.0) loofah (2.2.3) crass (~> 1.0.2) nokogiri (>= 1.5.9) + m (1.5.1) + method_source (>= 0.6.7) + rake (>= 0.9.2.2) mail (2.7.1) mini_mime (>= 0.1.1) marcel (0.3.3) @@ -106,6 +112,7 @@ GEM rake (>= 0.8.7) thor (>= 0.19.0, < 2.0) rake (12.3.2) + rexml (3.2.4) sprockets (3.7.2) concurrent-ruby (~> 1.0) rack (> 1, < 3) @@ -127,6 +134,7 @@ PLATFORMS DEPENDENCIES appraisal + m maildown! rails (= 5.2.3) railties @@ -134,4 +142,4 @@ DEPENDENCIES sqlite3 (~> 1.3.6) BUNDLED WITH - 2.0.2 + 2.1.4 diff --git a/gemfiles/rails_6.gemfile.lock b/gemfiles/rails_6.gemfile.lock index 5d29586..7db9a46 100644 --- a/gemfiles/rails_6.gemfile.lock +++ b/gemfiles/rails_6.gemfile.lock @@ -3,7 +3,7 @@ PATH specs: maildown (3.1.0) actionmailer (>= 4.0.0) - kramdown + kramdown-parser-gfm GEM remote: https://rubygems.org/ @@ -75,10 +75,16 @@ GEM activesupport (>= 4.2.0) i18n (1.6.0) concurrent-ruby (~> 1.0) - kramdown (2.1.0) + kramdown (2.2.1) + rexml + kramdown-parser-gfm (1.1.0) + kramdown (~> 2.0) loofah (2.3.0) crass (~> 1.0.2) nokogiri (>= 1.5.9) + m (1.5.1) + method_source (>= 0.6.7) + rake (>= 0.9.2.2) mail (2.7.1) mini_mime (>= 0.1.1) marcel (0.3.3) @@ -121,6 +127,7 @@ GEM rake (>= 0.8.7) thor (>= 0.20.3, < 2.0) rake (13.0.0) + rexml (3.2.4) sprockets (3.7.2) concurrent-ruby (~> 1.0) rack (> 1, < 3) @@ -143,6 +150,7 @@ PLATFORMS DEPENDENCIES appraisal + m maildown! rails (= 6.0.0) railties @@ -150,4 +158,4 @@ DEPENDENCIES sqlite3 (~> 1.4) BUNDLED WITH - 2.0.2 + 2.1.4 diff --git a/gemfiles/rails_head.gemfile.lock b/gemfiles/rails_head.gemfile.lock index 37b5a8c..d757c98 100644 --- a/gemfiles/rails_head.gemfile.lock +++ b/gemfiles/rails_head.gemfile.lock @@ -84,7 +84,7 @@ PATH specs: maildown (3.1.0) actionmailer (>= 4.0.0) - kramdown + kramdown-parser-gfm GEM remote: https://rubygems.org/ @@ -101,10 +101,16 @@ GEM activesupport (>= 4.2.0) i18n (1.6.0) concurrent-ruby (~> 1.0) - kramdown (2.1.0) + kramdown (2.2.1) + rexml + kramdown-parser-gfm (1.1.0) + kramdown (~> 2.0) loofah (2.2.3) crass (~> 1.0.2) nokogiri (>= 1.5.9) + m (1.5.1) + method_source (>= 0.6.7) + rake (>= 0.9.2.2) mail (2.7.1) mini_mime (>= 0.1.1) marcel (0.3.3) @@ -126,6 +132,7 @@ GEM rails-html-sanitizer (1.0.4) loofah (~> 2.2, >= 2.2.2) rake (12.3.2) + rexml (3.2.4) sprockets (3.7.2) concurrent-ruby (~> 1.0) rack (> 1, < 3) @@ -148,6 +155,7 @@ PLATFORMS DEPENDENCIES appraisal + m maildown! rails! railties @@ -155,4 +163,4 @@ DEPENDENCIES sqlite3 (~> 1.4) BUNDLED WITH - 2.0.2 + 2.1.4 diff --git a/lib/maildown/markdown_engine.rb b/lib/maildown/markdown_engine.rb index 16e8e74..7cc5354 100644 --- a/lib/maildown/markdown_engine.rb +++ b/lib/maildown/markdown_engine.rb @@ -49,7 +49,7 @@ def self.text_block end def self.default_html_block - ->(string) { Kramdown::Document.new(string).to_html } + ->(string) { Kramdown::Document.new(string, input: "GFM").to_html } end def self.default_text_block diff --git a/maildown.gemspec b/maildown.gemspec index ead02ec..38c567b 100644 --- a/maildown.gemspec +++ b/maildown.gemspec @@ -18,9 +18,10 @@ Gem::Specification.new do |s| s.test_files = Dir["test/**/*"] s.add_dependency "actionmailer", ">= 4.0.0" - s.add_dependency "kramdown" + s.add_dependency "kramdown-parser-gfm" s.add_development_dependency "railties" + s.add_development_dependency "m" s.add_development_dependency "sqlite3" s.add_development_dependency "rake" end diff --git a/test/test_helper.rb b/test/test_helper.rb index a5e7b4d..fdcad47 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -3,7 +3,7 @@ require File.expand_path("../dummy/config/environment.rb", __FILE__) require "rails/test_help" -require "kramdown" +require "kramdown-parser-gfm" Rails.backtrace_cleaner.remove_silencers! diff --git a/test/unit/markdown_engine_test.rb b/test/unit/markdown_engine_test.rb index 0f73c71..6f52d11 100644 --- a/test/unit/markdown_engine_test.rb +++ b/test/unit/markdown_engine_test.rb @@ -34,4 +34,11 @@ def teardown end thread.join end + + test "handles code fences (GFM)" do + markdown = "```\nbar\n```" + + actual = Maildown::MarkdownEngine.to_html(markdown) + assert_equal "
bar\n
\n", actual + end end