Jekyll doesn't stand out

My Jekyll blog (Github pages) doesn't seem to highlight the syntax correctly, either locally or hosted on Github. My _config.yml as follows

 #Others markdown: kramdown # Syntax highlighting highlighter: rouge kramdown: input: GFM syntax_highlighter: rouge 

And in one post I tried to enclose a block of code with a python tag, like this

 ```python import urllib2 from bs4 import BeautifulSoup html = urllib2.urlopen( "http://www.google.com" ).read() soup = BeautifulSoup(html) ``` 

But this makes the page an unlit link . Github code is available here . The version of Jekyll on my system is 3.1.1 .

+5
source share
1 answer

There are three ways to write code snippets in jekyll:

1 - jekyll backlight

 {% highlight python %} import urllib2 [...] {% endhighlight %} 

2 - secure code block

 ```python import urllib2 [...] ``` ~~~python import urllib2 [...] ~~~ 

3 - markdown 4 prints in space

  import urllib2 [...] 

Only the first and second can generate blush code. The third, the one you are actually using, only surrounds your code with a tag, but rouge or any marker you set will not be used by kramdown.

So, you can switch to the first or second solution.

Another thing, if you want to "color your code", you need to highlight css. You can search for pigment style sheets.

+8
source

All Articles