Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jekyll: Highlighting code snippets using markdown syntax

The Jekyll docs state that code highlighting is done using Liquid tags as follows:

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

However, I would rather like to use Markdown syntax:

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

I tried it myself the following way:

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

However, the result does not look the way it should.

enter image description here

like image 308
orschiro Avatar asked Dec 26 '22 17:12

orschiro


1 Answers

I had to add the following to my _config.yml to get my GitHub Pages syntax highlighting to work:

markdown: redcarpet
extensions: [fenced_code_blocks]

I don't know why fenced_code_blocks is required for GitHub Pages, since it's supposed to be enabled by default in Jekyll.

like image 105
Rag Avatar answered Jan 09 '23 01:01

Rag