New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unclosed rouge highlighting #4432

Closed
tomasfejfar opened this Issue Jan 31, 2016 · 17 comments

Comments

Projects
None yet
9 participants
@tomasfejfar
Contributor

tomasfejfar commented Jan 31, 2016

I have a post:

---
layout: post
status: publish
published: true
title: This blog is now on Jekyll
date: '2016-01-31 00:00:00 +0200'
tags: []
excerpt: Some excerpt

---
This is not yet highlighted
{% highlight php linenos %}
test
{% endhighlight %}

This should not be highlighted, right? 

And it generates this:
image

Actual HTML:

<p>This is not yet highlighted</p>

<div class="highlight"><pre><code class="language-php" data-lang="php">
    <table style="border-spacing: 0">
        <tbody>
        <tr>
            <td class="gutter gl" style="text-align: right">
                <pre class="lineno">1</pre>
            </td>
            <td class="code"><pre>test<span class="w"></span></pre>
            </td>
        </tr>
        </tbody>
    </table>


    This should not be highlighted, right?
</code></pre>
</div>

      <hr>

My config (relevant part):

permalink:   /:title/
markdown:    kramdown
highlighter: rouge
sass:
  sass_dir: _sass
  style: compressed
gems:
  - jekyll-sitemap

kramdown:

  auto_ids: true
  footnote_nr: 1
  entity_output: as_char
  toc_levels: 1..6
  enable_coderay: false
  syntax_highlighter: rouge
  line_numbers: true

Could this be theme issue? And if so, how could I debug it? It seems to me like a problem in parsing the closing endhighlight tag...

@tomasfejfar

This comment has been minimized.

Show comment
Hide comment
@tomasfejfar

tomasfejfar Jan 31, 2016

Contributor

I just noticed that it's rendered correctly if I remove the linenos from the highlight tag. Am I doing it wrong?

Contributor

tomasfejfar commented Jan 31, 2016

I just noticed that it's rendered correctly if I remove the linenos from the highlight tag. Am I doing it wrong?

@parkr

This comment has been minimized.

Show comment
Hide comment
@parkr

parkr Feb 1, 2016

Member

If you inspect the element and futz around with the CSS, is it fixable by modifying the CSS?

Member

parkr commented Feb 1, 2016

If you inspect the element and futz around with the CSS, is it fixable by modifying the CSS?

@tomasfejfar

This comment has been minimized.

Show comment
Hide comment
@tomasfejfar

tomasfejfar Feb 1, 2016

Contributor

I updated the first post with reformated HTML to make it more obvious. The problem is that the generated HTML does not close the <div class="highlight"><pre><code class="language-php" data-lang="php"> soon enough. It contains the content that was BELOW the {% endhighlight %} in the MD file.

Contributor

tomasfejfar commented Feb 1, 2016

I updated the first post with reformated HTML to make it more obvious. The problem is that the generated HTML does not close the <div class="highlight"><pre><code class="language-php" data-lang="php"> soon enough. It contains the content that was BELOW the {% endhighlight %} in the MD file.

@parkr parkr added the bug label Feb 2, 2016

@oapdf1

This comment has been minimized.

Show comment
Hide comment
@oapdf1

oapdf1 Feb 4, 2016

I have to update my blog in Github page from pygment to rouge today. I also meet this bug when I used the linenos option. The last highlight block by {% highlight vb linenos %} will end </div> at wrong place.
BTW, can rouge unify the format for `````....```` and {% highlight vb %} tag?
The previous one format as:
`

`
and the later one is:
`
`.
The later one is similar to that in pygment and I don't need to modify my css ( I have to setup the background color ...). Now I have to set up the style in both formats... :(

oapdf1 commented Feb 4, 2016

I have to update my blog in Github page from pygment to rouge today. I also meet this bug when I used the linenos option. The last highlight block by {% highlight vb linenos %} will end </div> at wrong place.
BTW, can rouge unify the format for `````....```` and {% highlight vb %} tag?
The previous one format as:
`

`
and the later one is:
`
`.
The later one is similar to that in pygment and I don't need to modify my css ( I have to setup the background color ...). Now I have to set up the style in both formats... :(

@parkr

This comment has been minimized.

Show comment
Hide comment
@parkr

parkr Feb 5, 2016

Member

This looks to me like a strange liquid parsing issue. Could you open a PR with a failing test cases for this inside of test/test_tags.rb in the highlighting section? Then we can go from there to find a fix.

Member

parkr commented Feb 5, 2016

This looks to me like a strange liquid parsing issue. Could you open a PR with a failing test cases for this inside of test/test_tags.rb in the highlighting section? Then we can go from there to find a fix.

@tomasfejfar

This comment has been minimized.

Show comment
Hide comment
@tomasfejfar

tomasfejfar Feb 5, 2016

Contributor

@parkr see the mentioned PR - I thought that there there is Travis here or something. I tried running the tests locally, but it does not seem to work as per instructions in CONTRIBUTING.markdown. I'm trying to do it on Windows which is probably not the best choice :( It tries to run bash shell, which I havent got ruby set up in and I try not to mess with it as I need it for other, non-ruby projects.

Contributor

tomasfejfar commented Feb 5, 2016

@parkr see the mentioned PR - I thought that there there is Travis here or something. I tried running the tests locally, but it does not seem to work as per instructions in CONTRIBUTING.markdown. I'm trying to do it on Windows which is probably not the best choice :( It tries to run bash shell, which I havent got ruby set up in and I try not to mess with it as I need it for other, non-ruby projects.

@tomasfejfar

This comment has been minimized.

Show comment
Hide comment
@tomasfejfar
Contributor

tomasfejfar commented Mar 24, 2016

@jekyllbot

This comment has been minimized.

Show comment
Hide comment
@jekyllbot

jekyllbot Jun 6, 2016

Contributor

This issue has been automatically marked as stale because it has not been commented on for at least
three months.

The resources of the Jekyll team are limited, and so we are asking for your help.

If you can still reproduce this error on the 3.1-stable or master branch,
please reply with all of the information you have about it in order to keep the issue open.

If this is a feature request, please consider building it first as a plugin. Jekyll 3 introduced
hooks which provide convenient access points throughout
the Jekyll build pipeline whereby most needs can be fulfilled. If this is something that cannot be
built as a plugin, then please provide more information about why in order to keep this issue open.

Thank you for all your contributions.

Contributor

jekyllbot commented Jun 6, 2016

This issue has been automatically marked as stale because it has not been commented on for at least
three months.

The resources of the Jekyll team are limited, and so we are asking for your help.

If you can still reproduce this error on the 3.1-stable or master branch,
please reply with all of the information you have about it in order to keep the issue open.

If this is a feature request, please consider building it first as a plugin. Jekyll 3 introduced
hooks which provide convenient access points throughout
the Jekyll build pipeline whereby most needs can be fulfilled. If this is something that cannot be
built as a plugin, then please provide more information about why in order to keep this issue open.

Thank you for all your contributions.

@oddlyfunctional

This comment has been minimized.

Show comment
Hide comment
@oddlyfunctional

oddlyfunctional Sep 20, 2016

Any news? This is also happening to me.

oddlyfunctional commented Sep 20, 2016

Any news? This is also happening to me.

@pschfr

This comment has been minimized.

Show comment
Hide comment
@pschfr

pschfr Aug 23, 2017

I still face this too :(

pschfr commented Aug 23, 2017

I still face this too :(

@DirtyF

This comment has been minimized.

Show comment
Hide comment
@DirtyF

DirtyF Aug 24, 2017

Member

Far anyone experiencing this issue, could you confirm that it works with latest release of Jekyll who provides support for Rouge 2 and Liquid 4 ?

gem install jekyll
bundle update
bundle exec jekyll serve

For my test case I didn't touch the default _config.ymlof jekyll new, I just added lineos option to the default post:

{% highlight ruby linenos %}
def print_hi(name)
  puts "Hi, #{name}"
end
print_hi('Tom')
#=> prints 'Hi, Tom' to STDOUT.
{% endhighlight %}

{% highlight php linenos %}
<?php phpinfo(); ?>
{% endhighlight %}

Code blocks are properly highlighted with line numbers:

lineos-jekyll

Member

DirtyF commented Aug 24, 2017

Far anyone experiencing this issue, could you confirm that it works with latest release of Jekyll who provides support for Rouge 2 and Liquid 4 ?

gem install jekyll
bundle update
bundle exec jekyll serve

For my test case I didn't touch the default _config.ymlof jekyll new, I just added lineos option to the default post:

{% highlight ruby linenos %}
def print_hi(name)
  puts "Hi, #{name}"
end
print_hi('Tom')
#=> prints 'Hi, Tom' to STDOUT.
{% endhighlight %}

{% highlight php linenos %}
<?php phpinfo(); ?>
{% endhighlight %}

Code blocks are properly highlighted with line numbers:

lineos-jekyll

@m451

This comment has been minimized.

Show comment
Hide comment
@m451

m451 Jan 21, 2018

@DirtyF it's still happening to me. But in my case it seems related to this issue with jekyll-compress-html.

m451 commented Jan 21, 2018

@DirtyF it's still happening to me. But in my case it seems related to this issue with jekyll-compress-html.

@oe

This comment has been minimized.

Show comment
Hide comment
@oe

oe Jan 21, 2018

Member

@m451 what version of jekyll are you on? if it's the latest one, could you open a new issue?

Member

oe commented Jan 21, 2018

@m451 what version of jekyll are you on? if it's the latest one, could you open a new issue?

@DirtyF

This comment has been minimized.

Show comment
Hide comment
@DirtyF

DirtyF Jan 21, 2018

Member

@m451 and if you don't use the compress layout in base layout?

Member

DirtyF commented Jan 21, 2018

@m451 and if you don't use the compress layout in base layout?

@DirtyF

This comment has been minimized.

Show comment
Hide comment
@DirtyF

DirtyF Jan 21, 2018

Member

Consider this resolved as when testing with latest Jekyll and the original post example, rendering is fine with default theme:

test-4432

Member

DirtyF commented Jan 21, 2018

Consider this resolved as when testing with latest Jekyll and the original post example, rendering is fine with default theme:

test-4432

@m451

This comment has been minimized.

Show comment
Hide comment
@m451

m451 Jan 21, 2018

@DirtyF it doesn't happen when I don't use the compress layout. Thus for now I've thrown that out.
@pup I've tested this with jekyll 3.6.2 and it was happening with the latest (todays) github-pages gem on github pages as well.

But I believe it's more a issue with the compress layout rather then Jekyll per-se.

m451 commented Jan 21, 2018

@DirtyF it doesn't happen when I don't use the compress layout. Thus for now I've thrown that out.
@pup I've tested this with jekyll 3.6.2 and it was happening with the latest (todays) github-pages gem on github pages as well.

But I believe it's more a issue with the compress layout rather then Jekyll per-se.

@DirtyF

This comment has been minimized.

Show comment
Hide comment
@DirtyF

DirtyF Jan 21, 2018

Member

@m451 Instead of the compress layout, you can give a try to jekyll-tidy plugin who has a html compression option.

Member

DirtyF commented Jan 21, 2018

@m451 Instead of the compress layout, you can give a try to jekyll-tidy plugin who has a html compression option.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment