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?
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 .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.