- Should remove space each line
{{
and}}
is GitBook template{%
and%}
is handlebar template
{{lang}}
: language for highlight{{{content}}}
: Code{{originalPath}}
: file path{{fileName}}
: file name{{count}}
: number of CodeBlock{{title}}
: if label containtitle:
like this[import, title:<value>]
{{id}}
: if label containid:
like this[import, id:<value>]
{{class}}
: if label containclass:
like this[import, class:<value>]
- {{edit}} : allow code edition
- {{check}} : allow syntax validation
- {{theme}} : label for the theme
You should write with no space(indent). Spacing conflict GitBook behavior.
Version 1.x template.
{{#if title}}
{{#if id}}
{% if file.type=="asciidoc" %}
> [[{{id}}]]link:{{originalPath}}[{{title}}]
{% else %}
> <a id="{{id}}" href="{{originalPath}}">{{title}}</a>
{% endif %}
{{else}}
{% if file.type=="asciidoc" %}
> [[{{title}}]]link:{{originalPath}}[{{title}}]
{% else %}
> <a id="{{title}}" href="{{originalPath}}">{{title}}</a>
{% endif %}
{{/if}}
{{else}}
{% if file.type=="asciidoc" %}
> [[{{fileName}}]]link:{{originalPath}}[{{fileName}}]
{% else %}
> <a id="{{fileName}}" href="{{originalPath}}">{{fileName}}</a>
{% endif %}
{{/if}}
``` {{lang}}
{{{content}}}
```
If use version 1.x template
[import](test.rs)
to be
{% if file.type=="asciidoc" %}
> [[test.rs]]link:test.rs[test.rs]
{% else %}
> <a id="test.rs" href="test.rs">test.rs</a>
{% endif %}
``` rust
extern crate num;
```