1
votes

I want to highlight some code in Jeckyll. With liquid tags it works and with kramdown it doesn't:

# This is highlighted
{% highlight C %}
void foo(){
}
{% endhighlight %}

# These aren't
~~~ C
void foo(){
}
~~~

``` C
void foo(){
}
```

The relevant parts of my _config.yml:

markdown: kramdown
kramdown:
  input: GFM

Does Jekyll not support markdown code blocks? If I stick this in github pages, will it work there?

1

1 Answers

1
votes

GitHub Pages uses Pygments as the default syntax highlighter and the Liquid tag that wraps your code generates a lot of additional markup in the resulting HTML to make the code look pretty.

The back-tick and tilde Markdown notation simply wrap your code in <pre><code class="language-c"> tags. If you want to use Markdown and have the resulting HTML be syntax highlighted you can add a client-side solution to your HTML templates, such as Highlight.js.