Jekyll Edit Markdown Samples
Jekyll file structure
Jekyll uses the Liquid ( https://github.com/Shopify/liquid/wiki ) templating language to process templates
Jekyll file starts with a triple dash - - - , to define a Jekyll header
The header part is in Yaml syntax, until closing - - -, then there is the body part
The body content is itself evaluated by Jekyll using the Liquid template engine, and passing a contextual list of variables=value.
This context inherits parent context values: page -> parent _config.xml layout fragment -> parent page -> parent _config.xml
Jekyll directory project structure
files and dirs starting with underscores (“_”) are interpreted by Jekyll
typical directory structure:
Liquid templating engine overview
Liquid https://github.com/Shopify/liquid
defines itself as “
Liquid markup language. Safe, customer facing template language for flexible web apps.
http://liquidmarkup.org/”
See documentation : http://docs.shopify.com/themes/liquid-documentation/basics See video http://www.youtube.com/watch?feature=player_embedded&v=tZLTExLukSg (which last 6 minutes only)
It is a kind of text pre-processor in Ruby (like Velocity or ThymLeaf in Java, T4 in C#, Angular expression/directives in JavaScript, etc..)
Like AngularJS, it has a mustach-like syntax for variable, and like Velocity, it has begin-tag / end-tag for macros
A picture is worth a thousands words:
More in details:
- replaces variables by their value
- filter expression and format
- execute tag macro
Tag macro can be developped as plugin and added
- loops tag
- if tag
- Include a file content, from _includes/subdir/file
( notice: work only with path as variable:
- Include a file content, relative to the current file :
Jekyll > Liquid > Pygments : adding code snippets with syntax hilight in Jekyll pages
see | http://jekyllrb.com/docs/templates/ |
Jekyll uses python Pygments librairy: http://pygments.org/
install using
and also edit your Jekyll _config.yaml to add
Pygments has itself tons of supported lexer for langages: http://pygments.org/languages/
( detailed list: http://pygments.org/docs/lexers/ )
- Java
- Ruby (Liquid is itself written in Ruby… so cited here)
- Xml (with tons of <tag/> for escaping <tag/> in rendered html…)
- Html (with tons of <tag/> for escaping <tag/> in rendered html…):
- Liquid
{% highlight liquid %}
{% raw %}
... {%if %} bla bla {{ var }} {% endif %}
{% endraw %}
{% endhighlight %}
This is a Meta-headache : Formating Liquid text to escape from Liquid code… (containing {% raw %} …)
- Liquid Blog explained in blog … Meta-Meta headache (for Advanced curious developpers only)
Note: You may have noticed that to write it myself in this blog (Meta-Meta-Headake), I should myself double the wrapping with highlight/raw ../endraw/endhighlight !!! But I also had to cheat by adding a space (invisible <span/> in html) between { and % to disable the first endraw that was doubled ! Then finally, I took up the intermediate generated html, copy&pasted it in this blog by wrapping it by raw..endraw !!
You may browse the real source page in this Blog github: raw source code… https://github.com/Arnaud-Nauwynck/Arnaud-Nauwynck.github.io/blob/master/_posts/2014-10-28-jekyll-edit-markdown-samples.markdown”