Installation:
ArchLinux:
$ sudo pacman-s python2-pygments
or through PIP installation:
$ pip Install pygments--user
I'm using an Ubuntu installation, and the command is:
sudo apt-get install python-pygments
Configuration:
Open Pygments in Jekyll's configuration article _config.yml
Pygments:true
Mardown:redcarpet
This is typically the case, but the new version needs to replace Pygments:true with highlighter:pygments
Once configured, we go to build the CSS file
Input:
Pygmentize-s default-f HTML >/root/desktop/pygments.css
Remember to fill in the path where you want to build
After the build, add the style to the Web site, and then invoke the code as follows:
<link rel= "stylesheet" href= "/css/pygments.css" >
Insert this code into the _includes/header.html call
Pygments.css need to put in your Jekyll CSS directory
Use:
The highlighted code must be placed between the label {% highlight language%} and {% endhighlight%}, where the language is the language you highlighted.
Example:
{% highlight Python%}
#use Jekyll pygments
#include <stdio.h>
JY = ' Jekyll '
print ' Use to%s '% (JY)
{% Endhighlight%}
The result of the build to the article is
#use Jekyll
JY = ' Jekyll '
print ' Use to%s '% (JY)
The style of the pygments
The default styles are Monokai, Manni, RRT, Perldoc, Borland, colorful, default, and so on.
Individuals still prefer the default style.
You can use the Python command to list Pygments currently supported styles:
>>> from pygments.styles import Style_map
>>> Style_map.keys ()
[' Monokai ', ' Manni ', ' RRT ', ' Perldoc ', ' Borland ', ' colorful ', ' Default ', ' Murphy ', ' vs ', '
' Trac ', ' Tango ', ' fruity ', ' autumn ', ' bw ', ' emacs ', ' vim ', ' pastie ', ' friendly ', ' native '
I will not intercept the style diagram, I find it, I think the default is better.
If you find a favorite style, you can upload the CSS file for that style, and the command is as follows:
$ pygmentize-s Style name-F HTML > YOUR/PATH/PYGMENTS.CSS
Basically so, will not typesetting, do this look at it!!!