Jekyll不正确的语法突出显示 [英] Jekyll incorrect syntax highlighting

查看:95
本文介绍了Jekyll不正确的语法突出显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想为一小段C代码提供正确的语法突出显示.我目前正在使用以下标签:

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 %}

当我使用"jekyll服务"在本地服务我的页面时,一切正常.但是,当我执行git push并查看Web页面时,语法高亮显示的结果不正确.许多行错误地显示为注释.

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> 

另一方面,如果我检查Web上的源,则会看到:

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

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

我不确定是什么引起了问题.这是我的第一个Jekyll网站,因此我对该工具没有任何经验.对于解决此问题的任何帮助或建议,将不胜感激.

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.

您可以在 https://github.com/grouma/grouma.github上查看源代码. io http://garyroumanis.com/2014/07/05/sous-vide/.

编辑

我已将标签更改为{%Highlight c ++%},它可以正常工作.相当混乱,但至少暂时尚可读取.

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.

推荐答案

自Jekyll v2.1.0起已修复: https://github.com/jekyll/jekyll/pull/2511

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

这篇关于Jekyll不正确的语法突出显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆