Content
15 Sep 2016Syntax highlighting
If the generic template theme is used, syntax highlighting can be enabled by setting the conf.theme.lib.highlightjs.enable
to true
.
That will make code examples being highlighted:
(x: x + 1) 1
Metadata
Metadata in the nix format can be attached at the head of markup files by surrounding it by {---
and ---}
.
{---
draft = true;
---}
## Lorem ipsum
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Introduction
The introduction separator >>>
can be used to add a content introduction, example:
A lorem ipsum post.
>>>
## Lorem ipsum
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Nix code evaluation
Nix code can be evaluated by surrounding it by {{
}}
, example:
{{ lib.toString (2 + 2) }}
Will result in 4.
This allows to call templates from markup file, for example:
{{ templates.media.youtube { id = "YbUPdv03ciI"; } }}
Will embed a youtube video:
Mathjax support
If the generic template theme is used, MathJax can be enabled by setting the conf.theme.lib.mathjax.enable
to true
.
For markdown content, surround the MathJax expression between $$
:
$$C = \alpha + \beta Y^{\gamma} + \epsilon$$
For asciidoc content, use the latexmath:[]
construct:
latexmath:[C = \alpha + \beta Y^{\gamma} + \epsilon]
Example of a rendered Mathjax expression:
\[C = \alpha + \beta Y^{\gamma} + \epsilon\]
Internal links
Internal links can be generated by using templates.tag.ilink
:
Site information can be found at the {{ templates.tag.ilink { to = pages.about; } }} page.
Site information can be found at the About page.
By default, the link text will be the page title, but it is possible to set a custom text:
Site information can be found {{ templates.tag.ilink { to = pages.about; content = "here"; } }}.
Site information can be found here.
For contents that are set as lists, like posts, find
can be used:
Learn more about drafts {{ templates.tag.ilink { to = lib.find { uid = "drafts-intro"; } pages.posts.list; content = "here"; } }}.
Learn more about drafts here.