I would like to include highlighted source code within a post.
I know that you can include a gist like this:
{% gist 5555251 %}
But can you also include arbitrary source code from a local file?
I would like to include highlighted source code within a post.
I know that you can include a gist like this:
{% gist 5555251 %}
But can you also include arbitrary source code from a local file?
There are different ways, a bit slow but easy just using something like http://highlightjs.org
Or you can use jekyll with pygments:
Install: apt-get install python-pygments
configure in _config: pygments: true
Create the highlithing css: pygmentize -S default -f html > stylesheets/pygments.css
Don't forget to load the css in your page! source: http://www.stehem.net/2012/02/14/how-to-get-pygments-to-work-with-jekyll.html
Or you can use Github flavored Markdown:
configure in _config: markdown: redcarpet
I'm not sure but i think you need to install the redcarpet gem and pygments manually that it work.
source: Github flavored Markdown and pygments highlighting in Jekyll
Use the SyntaxHighlighter-Plugin
<script type="text/javascript">SyntaxHighlighter.all()</script>
to inizialize the pluginSyntaxHighlighter.rb
in your _plugins
folderexample project https://bitbucket.org/l33tname/jekyll-syntaxhighlighter/src