Reputation: 1483
When writing markdown with code to be read by Jekyll, you can enable syntax highlighting with
{% highlight python %}
x = ('a', 1, False)
{% endhighlight %}
However, this becomes a bit verbose if you constantly switch between code and text. Is it possible to introduce a YAML variable in the header, like
---
layout: page
title: "Syntax highlighting"
tags : [python, jekyll]
language: python
---
so that every code block on this page will be highlighted like python, but only needs to be indented, and not fenced off?
Upvotes: 0
Views: 1407
Reputation: 1
Fenced blocks were introduced with Redcarpet 2. Jekyll now appears to support Redcarpet 2.
~~~ python
x = ('a', 1, False)
~~~
If you want it a little simpler you can make it a two-liner, but that’s the best deal you’re going to get.
x = ('a', 1, False) {:.language-python}
Upvotes: 3