Skip to content
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

Invalid highlight html with rouge and linenos #2607

Closed
kostrse opened this issue Jul 16, 2014 · 10 comments
Closed

Invalid highlight html with rouge and linenos #2607

kostrse opened this issue Jul 16, 2014 · 10 comments

Comments

@kostrse
Copy link

kostrse commented Jul 16, 2014

Invalid HTML generated when highlighter set to rouge and highlight has option linenos.

For kramdown and redcarpet html is slightly different, but in both cases invalid.

Original markdown:

before

{% highlight cs linenos %}
abc
def
{% endhighlight %}

after

Resulting html for redcarpet:

<p>before</p>
<div class="highlight">
    <pre>
        <code class="language-cs" data-lang="cs">
            <table style="border-spacing: 0">
                <tbody>
                    <tr>
                        <td class="gutter gl" style="text-align: right">
                            <pre class="lineno">
                                1
                                2
        </code>
                            </pre>
                        </td>
                        <td class="code">
                            <pre>
                                <span class="n">abc</span>
                                <span class="n">def</span>
                                <span class="w"></span>
                            </pre>
                        </td>
                    </tr>
                </tbody>
            </table>
    </pre>
</div>
<p>after</p>

Problem: code closed inside the table.

Resulting html for kramdown:

<p>before</p>
<div class="highlight">
    <pre>
        <code class="language-cs" data-lang="cs">
            <table style="border-spacing: 0">
                <tbody>
                    <tr>
                        <td class="gutter gl" style="text-align: right">
                            <pre class="lineno">
                            1
                            2
                            </pre>
                        </td>
                        <td class="code">
                            <pre>
                                <span class="n">abc</span>
                                <span class="n">def</span>
                                <span class="w"></span>
                            </pre>
                        </td>
                    </tr>
                </tbody>
            </table>
            after
        </code>
    </pre>
</div>

Problem: "after" inside highlighter div block, should be inside p after the block.

Reproduced with:

jekyll 2.1.1 and 2.2.0 (@phocks)
rouge 1.5.1
@parkr
Copy link
Member

parkr commented Aug 1, 2014

Interesting... no idea why this would be.

@phocks
Copy link
Contributor

phocks commented Aug 2, 2014

I can confirm this issue. I was going to create a new issue, but found this one. I was going to use 'rouge' as as my highlighter, but I need linenos, so looks like I'll have to stick with pygments. No worries.

@parkr
Copy link
Member

parkr commented Aug 2, 2014

Did it happen in Jekyll 2.1? #2676

@phocks
Copy link
Contributor

phocks commented Aug 2, 2014

I reproduced the invalid code with jekyll 2.2.0 running Ubuntu linux and tested it by creating a brand new 'jekyll new mysite' and editing the config...... I can maybe even have a look into why this is happening in the jekyll source when I get some free time later.

@parkr
Copy link
Member

parkr commented Aug 13, 2014

This seems to be a result of the weird mathn/classifier thing.

@parkr parkr added the Bug label Aug 13, 2014
@parkr parkr closed this as completed Aug 13, 2014
@parkr
Copy link
Member

parkr commented Aug 13, 2014

Re-open if Jekyll v2.3.0 doesn't solve your problem!

@aschamberger
Copy link

Still the same problem with v2.3.0.
With rouge and redcarpet the code tag is closed too early as described above.

@parkr parkr reopened this Aug 13, 2014
@cdeil
Copy link

cdeil commented Oct 19, 2014

I also ran into this issue with jekyll 2.4.0.

@envygeeks
Copy link
Contributor

It seems this was fixed with #3435 is this the case?

@aschamberger
Copy link

It's fixed.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

7 participants