Jekyll incorrect syntax highlighting

2019-08-22 02:10发布

问题:

I want to have correct syntax highlighting for a small snippet of C code. I'm currently using the following tags:

{% highlight c %}
 ... code snippet ...
{% endhighlight %}

When I serve my page locally using "jekyll serve" everything works as expected. However, when I do a git push and view the page on the web the results of the syntax highlighting are incorrect. A number of the lines incorrectly appear as comments.

If I inspect the source locally, I see the following:

<code class="language-c" data-lang="c">
...
</code> 

On the other hand if I inspect the source on the web I see:

 <code class="c">
    ...
 </code>

I'm not sure what is causing the issue. This is my first Jekyll website so I'm very inexperienced with the tool. Any help or suggestions to fix the issue will be greatly appreciated.

You can view the source at https://github.com/grouma/grouma.github.io and the corresponding page at http://garyroumanis.com/2014/07/05/sous-vide/.

EDIT

I have changed the tag to {% highlight c++ %} and it works as expected. Quite confused but at least it is readable for the time being.

回答1:

This has been fixed since Jekyll v2.1.0: https://github.com/jekyll/jekyll/pull/2511