Jekyll:使用markdown语法突出显示代码片段

时间:2013-11-30 16:29:51

标签: markdown jekyll github-flavored-markdown

代码突出显示的Jekyll docs状态使用Liquid标签完成,如下所示:

{% highlight ruby %}
def show
  @widget = Widget(params[:id])
  respond_to do |format|
    format.html # show.html.erb
    format.json { render json: @widget }
  end
end
{% endhighlight %}

但是,我更愿意使用Markdown语法:

```ruby
def foo
  puts 'foo'
end
```

我自己尝试了以下方式:

``` ini
; Disables the splash screen, if it has been compiled into the launcher.
RunLocally=true
```

然而,结果看起来不应该如此。

enter image description here

1 个答案:

答案 0 :(得分:10)

我不得不将以下内容添加到我的_config.yml中,以使我的GitHub Pages语法突出显示起作用:

markdown: redcarpet
extensions: [fenced_code_blocks]

我不知道为什么GitHub页面需要fenced_code_blocks,因为它应该默认在Jekyll中启用。

相关问题