带行号的带围栏的代码块

带行号的带围栏的代码块

本文介绍了Jekyll:带行号的带围栏的代码块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Jekyll将行号添加到Markdown的受围代码块中.

我尝试同时使用kramdownredcarpet并将line_numbers: true添加到_config.yml文件中(在适当的渲染器配置块下),但是我似乎无法在代码块上获得行号. /p>

解决方案:事实证明,我要做的就是切换回kramdown(默认的markdown渲染器),并使用{% highlight <language> linenos %}启动代码块,然后代码块获得行号.

解决方案

我使用了这篇很棒的帖子.它为我工作.至于行号使用,

{% highlight <language> linenos %}
     <code>
 {% endhighlight %}

在我的博客上检查一个示例,看看这是否是您想要的.

I'm trying to add line numbers to fenced code blocks in markdown with Jekyll.

I have tried using both kramdown and redcarpet and adding line_numbers: true to the _config.yml file (under the proper renderer config-block) but I can't seem to get line numbers on code blocks.

Solution:It turned out all I had to do was to switch back to kramdown (default markdown renderer) and start the code blocks with {% highlight <language> linenos %} and the code blocks gets line numbers.

解决方案

I used this great post. It worked for me. As for the line numbers use,

{% highlight <language> linenos %}
     <code>
 {% endhighlight %}

Check an example on my blog and see if this is what you want.

这篇关于Jekyll:带行号的带围栏的代码块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-29 18:41