diff --git a/History.markdown b/History.markdown index 910fef80..f27715d7 100644 --- a/History.markdown +++ b/History.markdown @@ -10,7 +10,6 @@ * Drop support for rdiscount (#6988) * Drop support for `jekyll-watch-1.4.0` and older (#7287) * Incorporate `relative_url` filter in `link` tag (#6727) - * Refactor `highlight` tag to behave like the `raw` tag (#6821) * Upgrade kramdown dependency to v2.x (#7492) * Upgrade i18n to v1.x (#6931) * Add `Jekyll::Cache` class to handle caching on disk (#7169) diff --git a/docs/_docs/upgrading/3-to-4.md b/docs/_docs/upgrading/3-to-4.md index fe3f40b5..8bd02757 100644 --- a/docs/_docs/upgrading/3-to-4.md +++ b/docs/_docs/upgrading/3-to-4.md @@ -35,8 +35,10 @@ gem update jekyll

{% highlight diff %} +{% raw %} - {{ site.baseurl }}/{% post_url 2018-03-20-hello-world.markdown %} + {% post_url 2018-03-20-hello-world.markdown %} +{% endraw %} {% endhighlight %} diff --git a/features/highlighting.feature b/features/highlighting.feature index 09d7af57..c9f2b00a 100644 --- a/features/highlighting.feature +++ b/features/highlighting.feature @@ -31,47 +31,3 @@ Feature: Syntax Highlighting When I run jekyll build Then I should get a zero exit-status And I should see "RewriteCond" in "_site/index.html" - - Scenario: highlighting an Liquid example - Given I have an "inspect.md" file with content: - """ - --- - title: Inspect Filter - --- - You can inspect a page's attributes with the `inspect` filter. You may enclose the - entire introspection within `
` tags to preserve the formatting:
-    {% highlight html %}
-    
-      {{ page | inspect }}
-    
- {% endhighlight %} - """ - When I run jekyll build - Then I should get a zero exit-status - And I should see "" in "_site/inspect.html" - And I should see "{{ page | inspect }}" in "_site/inspect.html" - - Scenario: highlighting an included snippet - Given I have an _includes directory - And I have an "_includes/inspector.html" file with content: - """ -
-      {{ page | inspect }}
-    
- """ - And I have an "inspect.md" file with content: - """ - --- - title: Inspect Filter - --- - You can inspect a page's attributes with the `inspect` filter. You may enclose the - entire introspection within `
` tags to preserve the formatting:
-    {% highlight html %}
-      {% include inspector.html %}
-    {% endhighlight %}
-    """
-    When I run jekyll build
-    Then I should get a zero exit-status
-    And I should see "" in "_site/inspect.html"
-    But I should not see "{{ page | inspect }}" in "_site/inspect.html"
-    But I should see "{% include inspector.html %}" in "_site/inspect.html"
diff --git a/jekyll.gemspec b/jekyll.gemspec
index 2db9b7b8..cdcb16ea 100644
--- a/jekyll.gemspec
+++ b/jekyll.gemspec
@@ -59,13 +59,6 @@ Gem::Specification.new do |s|
       * Our `post_url` tag now comes with the `relative_url` filter incorporated into it.
         You shouldn't prepend `{{ site.baseurl }}` to `{% post_url 2019-03-27-hello %}`
         For further details: https://github.com/jekyll/jekyll/pull/7589
-
-      * Our `highlight` tag no longer parses Liquid and Liquid-like constructs in the
-        tag's content body. While this means you no longer need to enclose the content
-        within a `{% raw %}{% endraw %}` block, it also means that you can no longer
-        do the following as well:
-        `{% highlight html %}{% include snippet.html %}{% endhighlight %}`
-        For further details: https://github.com/jekyll/jekyll/pull/6821
     ----------------------------------------------------------------------------------
   MSG
 end
diff --git a/lib/jekyll/tags/highlight.rb b/lib/jekyll/tags/highlight.rb
index a9310b32..72a2e6ba 100644
--- a/lib/jekyll/tags/highlight.rb
+++ b/lib/jekyll/tags/highlight.rb
@@ -2,7 +2,7 @@
 
 module Jekyll
   module Tags
-    class HighlightBlock < Liquid::Raw
+    class HighlightBlock < Liquid::Block
       include Liquid::StandardFilters
 
       # The regular expression syntax checker. Start with the language specifier.
@@ -33,7 +33,7 @@ module Jekyll
       def render(context)
         prefix = context["highlighter_prefix"] || ""
         suffix = context["highlighter_suffix"] || ""
-        code   = @body.gsub(LEADING_OR_TRAILING_LINE_TERMINATORS, "")
+        code = super.to_s.gsub(LEADING_OR_TRAILING_LINE_TERMINATORS, "")
 
         output =
           case context.registers[:site].highlighter
@@ -103,8 +103,6 @@ module Jekyll
         "
"\
         "#{code.chomp}
" end - - def ensure_valid_markup(tag_name, markup, parse_context); end end end end diff --git a/test/test_tags.rb b/test/test_tags.rb index 3c54a7f0..59cd190d 100644 --- a/test/test_tags.rb +++ b/test/test_tags.rb @@ -69,30 +69,6 @@ class TestTags < JekyllUnitTest end end - context "highlight tag" do - setup do - create_post <<~CONTENT - --- - title: This is a test - --- - - This is not yet highlighted - - {% highlight html %} -

{% unregistered_tag %}

- {{ page | inspect }} - {% endhighlight %} - - This should not be highlighted, right? - CONTENT - end - - should "not parse Liquid constructs in the tag markup" do - assert_match "{% unregistered_tag %}", @result - assert_match "{{ page | inspect }}", @result - end - end - context "highlight tag in unsafe mode" do should "set the no options with just a language name" do tag = highlight_block_with_opts("ruby ")