From 07490fe2a1125df4d3c00e3938e6fd5723547a00 Mon Sep 17 00:00:00 2001 From: Florian Thomas Date: Thu, 11 Aug 2016 22:43:36 +0200 Subject: [PATCH 1/7] bump rouge to 2.0.x --- jekyll.gemspec | 2 +- lib/jekyll.rb | 1 + .../converters/markdown/redcarpet_parser.rb | 2 +- lib/jekyll/tags/highlight.rb | 7 +++-- test/test_kramdown.rb | 5 +++- test/test_tags.rb | 26 +++++++++---------- 6 files changed, 25 insertions(+), 18 deletions(-) diff --git a/jekyll.gemspec b/jekyll.gemspec index a55392090f3..15464465177 100644 --- a/jekyll.gemspec +++ b/jekyll.gemspec @@ -37,6 +37,6 @@ Gem::Specification.new do |s| s.add_runtime_dependency("liquid", "~> 4.0") s.add_runtime_dependency("mercenary", "~> 0.3.3") s.add_runtime_dependency("pathutil", "~> 0.9") - s.add_runtime_dependency("rouge", "~> 1.7") + s.add_runtime_dependency("rouge", "~> 2.0.5") s.add_runtime_dependency("safe_yaml", "~> 1.0") end diff --git a/lib/jekyll.rb b/lib/jekyll.rb index 25bbaa0a47e..04a8f864d5e 100644 --- a/lib/jekyll.rb +++ b/lib/jekyll.rb @@ -30,6 +30,7 @@ def require_all(path) require "liquid" require "kramdown" require "colorator" +require "rouge" SafeYAML::OPTIONS[:suppress_warnings] = true diff --git a/lib/jekyll/converters/markdown/redcarpet_parser.rb b/lib/jekyll/converters/markdown/redcarpet_parser.rb index aa170feb3b7..98112379426 100644 --- a/lib/jekyll/converters/markdown/redcarpet_parser.rb +++ b/lib/jekyll/converters/markdown/redcarpet_parser.rb @@ -55,7 +55,7 @@ def block_code(code, lang) protected def rouge_formatter(_lexer) - Rouge::Formatters::HTML.new(:wrap => false) + Rouge::Formatters::HTMLLegacy.new(:wrap => false) end end diff --git a/lib/jekyll/tags/highlight.rb b/lib/jekyll/tags/highlight.rb index 86b9171b1fb..923a3828375 100644 --- a/lib/jekyll/tags/highlight.rb +++ b/lib/jekyll/tags/highlight.rb @@ -110,9 +110,12 @@ def render_pygments(code, is_safe) def render_rouge(code) Jekyll::External.require_with_graceful_fail("rouge") - formatter = Rouge::Formatters::HTML.new( + formatter = Rouge::Formatters::HTMLLegacy.new( :line_numbers => @highlight_options[:linenos], - :wrap => false + :wrap => false, + :css_class => "highlight", + :gutter_class => "gutter", + :code_class => "code" ) lexer = Rouge::Lexer.find_fancy(@lang, code) || Rouge::Lexers::PlainText formatter.format(lexer.lex(code)) diff --git a/test/test_kramdown.rb b/test/test_kramdown.rb index d8f886a4c1a..5f57f96dafa 100644 --- a/test/test_kramdown.rb +++ b/test/test_kramdown.rb @@ -16,7 +16,10 @@ class TestKramdown < JekyllUnitTest "syntax_highlighter" => "rouge", "syntax_highlighter_opts" => { - "bold_every" => 8, "css" => :class, + "bold_every" => 8, + "css" => :class, + "css_class" => "highlight", + "formatter" => ::Rouge::Formatters::HTMLLegacy, }, }, } diff --git a/test/test_tags.rb b/test/test_tags.rb index 0fe07aa6991..3690720cfe1 100644 --- a/test/test_tags.rb +++ b/test/test_tags.rb @@ -319,10 +319,10 @@ def highlight_block_with_opts(options_string) should "render markdown with rouge with line numbers" do assert_match( - %() + - %() + - %() + + %(
) + - %(
1
test\n
) + + %() + + %() + %(
) + + %(
1\n
test
), @result ) @@ -417,15 +417,15 @@ def highlight_block_with_opts(options_string) end should "should stop highlighting at boundary" do - expected = <<-EOS -

This is not yet highlighted

- -
1
test
-
- -

This should not be highlighted, right?

-EOS - assert_match(expected, @result) + assert_match( + %(

This is not yet highlighted

\n\n
) + + %(
) +
+            %() +
+            %(
) + + %(
1\n
test
\n\n) + + %(

This should not be highlighted, right?

), + @result + ) end end From 1f8338a15a072aadc1c829a2109f9ef5290bcb8c Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Wed, 15 Feb 2017 20:54:38 -0500 Subject: [PATCH 2/7] Allow use of *either* Rouge 1 or Rouge 2. --- .travis.yml | 2 ++ Gemfile | 2 ++ jekyll.gemspec | 2 +- lib/jekyll.rb | 1 - .../converters/markdown/redcarpet_parser.rb | 2 +- lib/jekyll/tags/highlight.rb | 3 +-- lib/jekyll/utils.rb | 1 + lib/jekyll/utils/rouge_formatter.rb | 16 ++++++++++++++++ test/test_kramdown.rb | 2 +- 9 files changed, 25 insertions(+), 6 deletions(-) create mode 100644 lib/jekyll/utils/rouge_formatter.rb diff --git a/.travis.yml b/.travis.yml index 3a6ef68bb67..29c56243315 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,6 +12,8 @@ rvm: matrix: include: + - rvm: + env: TEST_SUITE=test ROUGE=1.11.1 - rvm: *ruby1 env: TEST_SUITE=fmt - rvm: *ruby1 diff --git a/Gemfile b/Gemfile index 3a65e9ba2f6..1b734ec6502 100644 --- a/Gemfile +++ b/Gemfile @@ -3,6 +3,8 @@ gemspec :name => "jekyll" gem "rake", "~> 12.0" +gem "rouge", ENV["ROUGE"] if ENV["ROUGE"] + # Dependency of jekyll-mentions. RubyGems in Ruby 2.1 doesn't shield us from this. gem "activesupport", "~> 4.2", :groups => [:test_legacy, :site] if RUBY_VERSION < "2.2.2" diff --git a/jekyll.gemspec b/jekyll.gemspec index 15464465177..2174d22bd42 100644 --- a/jekyll.gemspec +++ b/jekyll.gemspec @@ -37,6 +37,6 @@ Gem::Specification.new do |s| s.add_runtime_dependency("liquid", "~> 4.0") s.add_runtime_dependency("mercenary", "~> 0.3.3") s.add_runtime_dependency("pathutil", "~> 0.9") - s.add_runtime_dependency("rouge", "~> 2.0.5") + s.add_runtime_dependency("rouge", ">= 1.7", "< 3") s.add_runtime_dependency("safe_yaml", "~> 1.0") end diff --git a/lib/jekyll.rb b/lib/jekyll.rb index 04a8f864d5e..25bbaa0a47e 100644 --- a/lib/jekyll.rb +++ b/lib/jekyll.rb @@ -30,7 +30,6 @@ def require_all(path) require "liquid" require "kramdown" require "colorator" -require "rouge" SafeYAML::OPTIONS[:suppress_warnings] = true diff --git a/lib/jekyll/converters/markdown/redcarpet_parser.rb b/lib/jekyll/converters/markdown/redcarpet_parser.rb index 98112379426..4b795f4e9d4 100644 --- a/lib/jekyll/converters/markdown/redcarpet_parser.rb +++ b/lib/jekyll/converters/markdown/redcarpet_parser.rb @@ -55,7 +55,7 @@ def block_code(code, lang) protected def rouge_formatter(_lexer) - Rouge::Formatters::HTMLLegacy.new(:wrap => false) + Jekyll::Utils::RougeFormatter.html(:wrap => false) end end diff --git a/lib/jekyll/tags/highlight.rb b/lib/jekyll/tags/highlight.rb index 923a3828375..90f80a9562b 100644 --- a/lib/jekyll/tags/highlight.rb +++ b/lib/jekyll/tags/highlight.rb @@ -109,8 +109,7 @@ def render_pygments(code, is_safe) end def render_rouge(code) - Jekyll::External.require_with_graceful_fail("rouge") - formatter = Rouge::Formatters::HTMLLegacy.new( + formatter = Jekyll::Utils::RougeFormatter.html( :line_numbers => @highlight_options[:linenos], :wrap => false, :css_class => "highlight", diff --git a/lib/jekyll/utils.rb b/lib/jekyll/utils.rb index 3f91a2b00fd..db94e91e97a 100644 --- a/lib/jekyll/utils.rb +++ b/lib/jekyll/utils.rb @@ -5,6 +5,7 @@ module Utils autoload :Ansi, "jekyll/utils/ansi" autoload :Exec, "jekyll/utils/exec" autoload :Platforms, "jekyll/utils/platforms" + autoload :RougeFormatter, "jekyll/utils/rouge_formatter" autoload :WinTZ, "jekyll/utils/win_tz" # Constants for use in #slugify diff --git a/lib/jekyll/utils/rouge_formatter.rb b/lib/jekyll/utils/rouge_formatter.rb new file mode 100644 index 00000000000..eccc4f93f5c --- /dev/null +++ b/lib/jekyll/utils/rouge_formatter.rb @@ -0,0 +1,16 @@ +module Jekyll + module Utils + module RougeFormatter + + def self.html(*args) + Jekyll::External.require_with_graceful_fail("rouge") + if Rouge.version < "2" + Rouge::Formatters::HTML.new(*args) + else + Rouge::Formatters::HTMLPygments.new(*args) + end + end + + end + end +end diff --git a/test/test_kramdown.rb b/test/test_kramdown.rb index 5f57f96dafa..ce3334b95d2 100644 --- a/test/test_kramdown.rb +++ b/test/test_kramdown.rb @@ -19,7 +19,7 @@ class TestKramdown < JekyllUnitTest "bold_every" => 8, "css" => :class, "css_class" => "highlight", - "formatter" => ::Rouge::Formatters::HTMLLegacy, + "formatter" => Jekyll::Utils::RougeFormatter.html.class, }, }, } From 3bc8e4993fca83b0adf4357caf5e8bb335b95f44 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Wed, 1 Mar 2017 20:49:15 -0500 Subject: [PATCH 3/7] WIP: Create shim that works for both Rouge 1 and Rouge 2 --- .../converters/markdown/redcarpet_parser.rb | 2 +- lib/jekyll/tags/highlight.rb | 2 +- lib/jekyll/utils.rb | 2 +- lib/jekyll/utils/rouge.rb | 19 ++++++++ lib/jekyll/utils/rouge_formatter.rb | 16 ------- test/test_kramdown.rb | 2 +- test/test_tags.rb | 45 ++++++++++++++----- 7 files changed, 57 insertions(+), 31 deletions(-) create mode 100644 lib/jekyll/utils/rouge.rb delete mode 100644 lib/jekyll/utils/rouge_formatter.rb diff --git a/lib/jekyll/converters/markdown/redcarpet_parser.rb b/lib/jekyll/converters/markdown/redcarpet_parser.rb index 4b795f4e9d4..64de526637b 100644 --- a/lib/jekyll/converters/markdown/redcarpet_parser.rb +++ b/lib/jekyll/converters/markdown/redcarpet_parser.rb @@ -55,7 +55,7 @@ def block_code(code, lang) protected def rouge_formatter(_lexer) - Jekyll::Utils::RougeFormatter.html(:wrap => false) + Jekyll::Utils::Rouge.html_formatter(:wrap => false) end end diff --git a/lib/jekyll/tags/highlight.rb b/lib/jekyll/tags/highlight.rb index 90f80a9562b..70dd37c6132 100644 --- a/lib/jekyll/tags/highlight.rb +++ b/lib/jekyll/tags/highlight.rb @@ -109,7 +109,7 @@ def render_pygments(code, is_safe) end def render_rouge(code) - formatter = Jekyll::Utils::RougeFormatter.html( + formatter = Jekyll::Utils::Rouge.html_formatter( :line_numbers => @highlight_options[:linenos], :wrap => false, :css_class => "highlight", diff --git a/lib/jekyll/utils.rb b/lib/jekyll/utils.rb index db94e91e97a..6dd4e753a4a 100644 --- a/lib/jekyll/utils.rb +++ b/lib/jekyll/utils.rb @@ -5,7 +5,7 @@ module Utils autoload :Ansi, "jekyll/utils/ansi" autoload :Exec, "jekyll/utils/exec" autoload :Platforms, "jekyll/utils/platforms" - autoload :RougeFormatter, "jekyll/utils/rouge_formatter" + autoload :Rouge, "jekyll/utils/rouge" autoload :WinTZ, "jekyll/utils/win_tz" # Constants for use in #slugify diff --git a/lib/jekyll/utils/rouge.rb b/lib/jekyll/utils/rouge.rb new file mode 100644 index 00000000000..8f381d4e419 --- /dev/null +++ b/lib/jekyll/utils/rouge.rb @@ -0,0 +1,19 @@ +module Jekyll + module Utils + module Rouge + + def self.html_formatter(*args) + Jekyll::External.require_with_graceful_fail("rouge") + html_formatter = ::Rouge::Formatters::HTML.new(*args) + return html_formatter if old_api? + + ::Rouge::Formatters::HTMLPygments.new(html_formatter) + end + + def self.old_api? + ::Rouge.version.to_s < "2" + end + + end + end +end diff --git a/lib/jekyll/utils/rouge_formatter.rb b/lib/jekyll/utils/rouge_formatter.rb deleted file mode 100644 index eccc4f93f5c..00000000000 --- a/lib/jekyll/utils/rouge_formatter.rb +++ /dev/null @@ -1,16 +0,0 @@ -module Jekyll - module Utils - module RougeFormatter - - def self.html(*args) - Jekyll::External.require_with_graceful_fail("rouge") - if Rouge.version < "2" - Rouge::Formatters::HTML.new(*args) - else - Rouge::Formatters::HTMLPygments.new(*args) - end - end - - end - end -end diff --git a/test/test_kramdown.rb b/test/test_kramdown.rb index ce3334b95d2..a75849da4e3 100644 --- a/test/test_kramdown.rb +++ b/test/test_kramdown.rb @@ -19,7 +19,7 @@ class TestKramdown < JekyllUnitTest "bold_every" => 8, "css" => :class, "css_class" => "highlight", - "formatter" => Jekyll::Utils::RougeFormatter.html.class, + "formatter" => Jekyll::Utils::Rouge.html_formatter.class, }, }, } diff --git a/test/test_tags.rb b/test/test_tags.rb index 3690720cfe1..fda6efaf21a 100644 --- a/test/test_tags.rb +++ b/test/test_tags.rb @@ -317,7 +317,8 @@ def highlight_block_with_opts(options_string) ) end - should "render markdown with rouge with line numbers" do + should "render markdown with rouge 2 with line numbers" do + skip "Skipped because using an older version of Rouge" if Utils::Rouge.old_api? assert_match( %() + %(
) + @@ -327,6 +328,18 @@ def highlight_block_with_opts(options_string) @result ) end + + should "render markdown with rouge 1 with line numbers" do + skip "Skipped because using a newer version of Rouge" unless Utils::Rouge.old_api? + assert_match( + %() + + %() + + %() + + %(
) + + %(
1
test\n
), + @result + ) + end end context "post content has highlight with file reference" do @@ -416,16 +429,26 @@ def highlight_block_with_opts(options_string) EOS end - should "should stop highlighting at boundary" do - assert_match( - %(

This is not yet highlighted

\n\n
) + - %(
) +
-            %() +
-            %(
) + - %(
1\n
test
\n\n) + - %(

This should not be highlighted, right?

), - @result - ) + should "should stop highlighting at boundary with rouge 1" do + skip "Skipped because using an older version of Rouge" if Utils::Rouge.old_api? + expected = <<-EOS +

This is not yet highlighted

+
1
test
+
+

This should not be highlighted, right?

+EOS + assert_match(expected, @result) + end + + should "should stop highlighting at boundary with rouge 2" do + skip "Skipped because using a newer version of Rouge" unless Utils::Rouge.old_api? + expected = <<-EOS +

This is not yet highlighted

\n +
1
test
+
\n +

This should not be highlighted, right?

+EOS + assert_match(expected, @result) end end From 2b20d109d5a3b920146a404aeebf987a263df2ba Mon Sep 17 00:00:00 2001 From: Florian Thomas Date: Tue, 20 Jun 2017 03:49:54 +0100 Subject: [PATCH 4/7] [Rouge 2] use `Rouge::Formatters::HTMLLegacy` and fix tests (#6150) * use `Rouge::Formatters::HTMLLegacy` and fix tests * set default rouge version to 2.1.0 * allow more than just 2.1.x versions by default --- jekyll.gemspec | 2 +- lib/jekyll/utils/rouge.rb | 10 +++++----- test/test_kramdown.rb | 5 +++-- test/test_tags.rb | 12 ++++++------ 4 files changed, 15 insertions(+), 14 deletions(-) diff --git a/jekyll.gemspec b/jekyll.gemspec index 8fd62e81828..68516ae94ce 100644 --- a/jekyll.gemspec +++ b/jekyll.gemspec @@ -38,6 +38,6 @@ Gem::Specification.new do |s| s.add_runtime_dependency("liquid", "~> 4.0") s.add_runtime_dependency("mercenary", "~> 0.3.3") s.add_runtime_dependency("pathutil", "~> 0.9") - s.add_runtime_dependency("rouge", "~> #{ENV["ROUGE_VERSION"] || "1.7"}") + s.add_runtime_dependency("rouge", "~> #{ENV["ROUGE_VERSION"] || "2.1"}") s.add_runtime_dependency("safe_yaml", "~> 1.0") end diff --git a/lib/jekyll/utils/rouge.rb b/lib/jekyll/utils/rouge.rb index 8f381d4e419..a00a5f9e743 100644 --- a/lib/jekyll/utils/rouge.rb +++ b/lib/jekyll/utils/rouge.rb @@ -4,16 +4,16 @@ module Rouge def self.html_formatter(*args) Jekyll::External.require_with_graceful_fail("rouge") - html_formatter = ::Rouge::Formatters::HTML.new(*args) - return html_formatter if old_api? - - ::Rouge::Formatters::HTMLPygments.new(html_formatter) + if old_api? + ::Rouge::Formatters::HTML.new(*args) + else + ::Rouge::Formatters::HTMLLegacy.new(*args) + end end def self.old_api? ::Rouge.version.to_s < "2" end - end end end diff --git a/test/test_kramdown.rb b/test/test_kramdown.rb index a75849da4e3..eaf28274543 100644 --- a/test/test_kramdown.rb +++ b/test/test_kramdown.rb @@ -62,8 +62,9 @@ class TestKramdown < JekyllUnitTest puts "Hello World" ~~~ MARKDOWN - - selector = "div.highlighter-rouge>pre.highlight>code" + div_highlight = "" + div_highlight = ">div.highlight" unless Utils::Rouge.old_api? + selector = "div.highlighter-rouge#{div_highlight}>pre.highlight>code" refute result.css(selector).empty? end diff --git a/test/test_tags.rb b/test/test_tags.rb index c6be8412f87..bfcb2e8f4a2 100644 --- a/test/test_tags.rb +++ b/test/test_tags.rb @@ -430,22 +430,22 @@ def highlight_block_with_opts(options_string) EOS end - should "should stop highlighting at boundary with rouge 1" do + should "should stop highlighting at boundary with rouge 2" do skip "Skipped because using an older version of Rouge" if Utils::Rouge.old_api? expected = <<-EOS -

This is not yet highlighted

-
1
test
-
+

This is not yet highlighted

\n +
1
+
test
\n

This should not be highlighted, right?

EOS assert_match(expected, @result) end - should "should stop highlighting at boundary with rouge 2" do + should "should stop highlighting at boundary with rouge 1" do skip "Skipped because using a newer version of Rouge" unless Utils::Rouge.old_api? expected = <<-EOS

This is not yet highlighted

\n -
1
test
+
1
test\n
 
\n

This should not be highlighted, right?

EOS From af847f0d4f2be7a3e8c19f501e9067c30fa1ca80 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Mon, 19 Jun 2017 22:51:26 -0400 Subject: [PATCH 5/7] Allow Rouge 1.x and 2.x --- jekyll.gemspec | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/jekyll.gemspec b/jekyll.gemspec index 68516ae94ce..a8bd05eabab 100644 --- a/jekyll.gemspec +++ b/jekyll.gemspec @@ -38,6 +38,7 @@ Gem::Specification.new do |s| s.add_runtime_dependency("liquid", "~> 4.0") s.add_runtime_dependency("mercenary", "~> 0.3.3") s.add_runtime_dependency("pathutil", "~> 0.9") - s.add_runtime_dependency("rouge", "~> #{ENV["ROUGE_VERSION"] || "2.1"}") + rouge_versions = ENV["ROUGE_VERSION"] ? ["~> #{ENV["ROUGE_VERSION"]}"] : [">= 1.7", "< 3"] + s.add_runtime_dependency("rouge", *rouge_versions) s.add_runtime_dependency("safe_yaml", "~> 1.0") end From 530d800ea422e190c574dfa4e62e11da9729348c Mon Sep 17 00:00:00 2001 From: Florian Thomas Date: Tue, 20 Jun 2017 14:05:13 +0100 Subject: [PATCH 6/7] fix travis for rouge 1.11 (#6161) - make sure rouge 1.11 tests are executed with ruby 2.4 - remove additional newline from test --- .travis.yml | 2 +- test/test_tags.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 24892acd801..00e21f93e19 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,7 +13,7 @@ rvm: matrix: include: - - rvm: + - rvm: *ruby1 env: TEST_SUITE=test ROUGE=1.11.1 - rvm: *ruby1 env: TEST_SUITE=fmt diff --git a/test/test_tags.rb b/test/test_tags.rb index bfcb2e8f4a2..81fbf8308ef 100644 --- a/test/test_tags.rb +++ b/test/test_tags.rb @@ -445,7 +445,7 @@ def highlight_block_with_opts(options_string) skip "Skipped because using a newer version of Rouge" unless Utils::Rouge.old_api? expected = <<-EOS

This is not yet highlighted

\n -
1
test\n
+
1
test
 
\n

This should not be highlighted, right?

EOS From 273fdbd63f0e830a59cc2f1c3026a36d9cfd482b Mon Sep 17 00:00:00 2001 From: Florian Thomas Date: Wed, 5 Jul 2017 17:45:30 +0100 Subject: [PATCH 7/7] bump kramdown to 1.14.0 for rouge 2 support (#6183) see https://kramdown.gettalong.org/news.html --- Gemfile | 2 +- jekyll.gemspec | 2 +- test/test_tags.rb | 36 ++++++++++++++++++++++++++++++++++++ 3 files changed, 38 insertions(+), 2 deletions(-) diff --git a/Gemfile b/Gemfile index 0dcce3c48dd..4a15b927ee0 100644 --- a/Gemfile +++ b/Gemfile @@ -70,7 +70,7 @@ group :jekyll_optional_dependencies do gem "jekyll-gist" gem "jekyll-paginate" gem "jekyll-redirect-from" - gem "kramdown", "~> 1.9" + gem "kramdown", "~> 1.14" gem "mime-types", "~> 3.0" gem "rdoc", "~> 5.0" gem "toml", "~> 0.1.0" diff --git a/jekyll.gemspec b/jekyll.gemspec index a8bd05eabab..0f2beece4af 100644 --- a/jekyll.gemspec +++ b/jekyll.gemspec @@ -34,7 +34,7 @@ Gem::Specification.new do |s| s.add_runtime_dependency("colorator", "~> 1.0") s.add_runtime_dependency("jekyll-sass-converter", "~> 1.0") s.add_runtime_dependency("jekyll-watch", "~> 1.1") - s.add_runtime_dependency("kramdown", "~> 1.3") + s.add_runtime_dependency("kramdown", "~> 1.14") s.add_runtime_dependency("liquid", "~> 4.0") s.add_runtime_dependency("mercenary", "~> 0.3.3") s.add_runtime_dependency("pathutil", "~> 0.9") diff --git a/test/test_tags.rb b/test/test_tags.rb index 81fbf8308ef..2add6098d04 100644 --- a/test/test_tags.rb +++ b/test/test_tags.rb @@ -343,6 +343,42 @@ def highlight_block_with_opts(options_string) end end + context "post content has raw tag" do + setup do + content = <<-CONTENT +--- +title: This is a test +--- + +```liquid +{% raw %} +{{ site.baseurl }}{% link _collection/name-of-document.md %} +{% endraw %} +``` +CONTENT + create_post(content) + end + + should "render markdown with rouge 1" do + skip "Skipped because using a newer version of Rouge" unless Utils::Rouge.old_api? + + assert_match( + %(
),
+          @result
+        )
+      end
+
+      should "render markdown with rouge 2" do
+        skip "Skipped because using an older version of Rouge" if Utils::Rouge.old_api?
+
+        assert_match(
+          %(
) + + %(
),
+          @result
+        )
+      end
+    end
+
     context "post content has highlight with file reference" do
       setup do
         fill_post("./jekyll.gemspec")