簡體   English   中英

Jekyll:使用markdown語法突出顯示代碼片段

[英]Jekyll: Highlighting code snippets using markdown syntax

Jekyll文檔聲明代碼突出顯示是使用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
```

但是,結果看起來並不應該如此。

在此輸入圖像描述

我必須將以下內容添加到我的_config.yml中,以使我的GitHub Pages語法突出顯示起作用:

markdown: redcarpet
extensions: [fenced_code_blocks]

我不知道為什么fenced_code_blocks Pages需要fenced_code_blocks ,因為它應該默認在Jekyll中啟用。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM