Jekyll中的语法突出显示markdown代码块(不使用液体标签) [英] Syntax highlighting markdown code blocks in Jekyll (without using liquid tags)

查看:192
本文介绍了Jekyll中的语法突出显示markdown代码块(不使用液体标签)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Jekyll中的语法突出显示似乎仅限于使用液体标签和色素,如下所示:

It seems like syntax highlighting in Jekyll is limited to using liquid tags and pygments like so:

{% highlight bash %}
cd ~
{% endhighlight %}

但是我已经从wordpress导入了我现有的博客,并且它是用markdown(使用markdown代码块)编写的,我不想遍历每篇文章并修复代码块.另外,我想将帖子保持为纯降价格式,以防万一我需要再次切换博客平台.

But I've imported my existing blog from wordpress and it was written in markdown (using markdown code blocks) and I don't want to have to go through each post and fix the code blocks. Also, I want to keep my posts in pure markdown format in case I ever need to switch blogging platforms again.

我将Jekyll解析器切换为redcarpet,希望可以使用这种markdown语法:

I switched my Jekyll parser to redcarpet with the hope that I could use this markdown syntax:

```bash
cd ~
```

但是它似乎不起作用.它只是将其包装在普通的code块中.有什么想法吗?

But it doesn't seem to work. It just wraps it in a normal code block. Any ideas?

推荐答案

我最终切换到 kramdown 来解析附带的markdown coderay 突出显示语法.这样做的好处是可以在heroku上使用纯红宝石解决方案.

I ended up switching to kramdown to parse markdown which comes with coderay for syntax highlighting. This has the benefit of being a pure ruby solution which works on heroku.

这篇关于Jekyll中的语法突出显示markdown代码块(不使用液体标签)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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