My Jekyll blog (Github pages) seems not to highlight the syntax properly, both locally hosted and hosted on Github. My _config.yml
looks as follows
#Others
markdown: kramdown
# Syntax highlighting
highlighter: rouge
kramdown:
input: GFM
syntax_highlighter: rouge
And in one post I tried fencing a code block with the python tag like this
```python
import urllib2
from bs4 import BeautifulSoup
html = urllib2.urlopen( "http://www.google.com" ).read()
soup = BeautifulSoup(html)
```
But this renders the page without highlights link. Code is on Github available here. Jekyll version on my system is 3.1.1
.
There is three ways to write code snippets in jekyll :
{% highlight python %}
import urllib2
[...]
{% endhighlight %}
```python
import urllib2
[...]
```
~~~python
import urllib2
[...]
~~~
import urllib2
[...]
Only first and second can produce code highlight with rouge. The third, the one that you actually use, only surround your code with tag, but rouge or any highlighter you set, will not be used by kramdown.
So, you can switch to first or second solution.
Another thing, if you want to "color your code", you need an highlight css. You can search for pygment style sheets.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With