jekyll / jekyll

:globe_with_meridians: Jekyll is a blog-aware static site generator in Ruby
https://jekyllrb.com
MIT License
48.95k stars 9.95k forks source link

broken codeblocks with pygments.rb and jekyll #5474

Closed shibumi closed 7 years ago

shibumi commented 7 years ago


Hello, Seems like pygments breaks their own codeblocks in jekyll.

Here is an example:

This is a simple yara file with highlighting as text.

{% highlight text  %}
rule dubrute : bruteforcer
{
    meta:
        author = "Christian Rebischke (@sh1bumi)"
        date = "2015-09-05"
        description = "Rules for DuBrute Bruteforcer"
        in_the_wild = true
        family = "Hackingtool/Bruteforcer"

    strings:
        $a = "WBrute"
        $b = "error.txt"
        $c = "good.txt"
        $d = "source.txt"
        $e = "bad.txt"
        $f = "Generator IP@Login;Password"

    condition:
        //check for MZ Signature at offset 0
        uint16(0) == 0x5A4D

        and

        //check for dubrute specific strings
        $a and $b and $c and $d and $e and $f
}
{% endhighlight %}

this compiles with jekyll to:

..

The Output I Wanted

The output should looks like the demo: http://pygments.org/demo/6256037/

zlatanvasovic commented 7 years ago

It seems the Pygments demo has been deleted. Can you re-upload it?

shibumi commented 7 years ago

@zdroid I have updated the link. Should work now: http://pygments.org/demo/6256037/

I have also the same problem with C-Code. When I have empty lines in Code between two braces {} everything is getting weird.

jekyllbot commented 7 years ago

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

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

If this is a bug and 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.

This issue will automatically be closed in two months if no further activity occurs. Thank you for all your contributions.

shibumi commented 7 years ago

push

pathawks commented 7 years ago

What version of Jekyll and Pygments are you using?

I cannot reproduce this issue. Using Jekyll 3.3.1, pygments 1.1.1, Minima 2.1.0

In _config.yml I added highlighter: pygments.

Can you provide a sample Jekyll site that exhibits this issue, or maybe link to your source repo?

pygments rb

shibumi commented 7 years ago

Hello, Here are my versions: jekyll 3.3.1 pygments 1.1.1 Minima 2.1.0

You can find my repo here: https://github.com/shibumi/en.nullday.de Have a look at the article: _posts/2015-09-05-dubrute.markdown

pathawks commented 7 years ago

Here is the generated HTML:

<p><figure class="highlight"><pre><code class="language-text" data-lang="text"><span></span>rule dubrute : bruteforcer
{
    meta:
        author = &quot;Christian Rebischke (@sh1bumi)&quot;
        date = &quot;2015-09-05&quot;
        description = &quot;Rules for DuBrute Bruteforcer&quot;
        in_the_wild = true
        family = &quot;Hackingtool/Bruteforcer&quot;</p>

<pre><code>strings:
    $a = &amp;quot;WBrute&amp;quot;
    $b = &amp;quot;error.txt&amp;quot;
    $c = &amp;quot;good.txt&amp;quot;
    $d = &amp;quot;source.txt&amp;quot;
    $e = &amp;quot;bad.txt&amp;quot;
    $f = &amp;quot;Generator IP@Login;Password&amp;quot;

condition:
    //check for MZ Signature at offset 0
    uint16(0) == 0x5A4D

    and

    //check for dubrute specific strings
    $a and $b and $c and $d and $e and $f
</code></pre>

<p>}</code></pre></figure></p>

Site appears to be using Rouge rather than Pygments, but both of them seem to exhibit the same issue.

pathawks commented 7 years ago

Looks like the problem is with rdiscount. When I configure the site to use kramdown instead, everything looks as expected.

shibumi commented 7 years ago

@pathawks So I should switch to kramdown? is the kramdown syntax equal to rdiscount?

pathawks commented 7 years ago

Kramdown is what most people use, and it is what we use by default for new sites.

I can't promise that the syntax is 100% identical. If you switch, you'll probably want to look through the generated site and make sure that everything looks proper.

jekyllbot commented 7 years ago

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

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

If this is a bug and you can still reproduce this error on the 3.3-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.

This issue will automatically be closed in two months if no further activity occurs. Thank you for all your contributions.

shibumi commented 7 years ago

@pathawks Thanks, kralmdown fixed this issue for me..