diff options
author | Samy Pessé <samypesse@gmail.com> | 2016-03-18 11:55:24 +0100 |
---|---|---|
committer | Samy Pessé <samypesse@gmail.com> | 2016-03-18 11:55:24 +0100 |
commit | 3a43ef2c3fb60e0920188200c796a0db6ce4ed3f (patch) | |
tree | 506058994011f671289338ad1e9e28c0768f126a /docs | |
parent | 55deab03cd5ed0fee18cb768a24625e079ea1b41 (diff) | |
download | gitbook-3a43ef2c3fb60e0920188200c796a0db6ce4ed3f.zip gitbook-3a43ef2c3fb60e0920188200c796a0db6ce4ed3f.tar.gz gitbook-3a43ef2c3fb60e0920188200c796a0db6ce4ed3f.tar.bz2 |
Add doc for inline rendering
Diffstat (limited to 'docs')
-rw-r--r-- | docs/SUMMARY.md | 1 | ||||
-rw-r--r-- | docs/plugins/api.md | 8 | ||||
-rw-r--r-- | docs/templating/builtin.md | 18 |
3 files changed, 27 insertions, 0 deletions
diff --git a/docs/SUMMARY.md b/docs/SUMMARY.md index b936e84..cf98051 100644 --- a/docs/SUMMARY.md +++ b/docs/SUMMARY.md @@ -31,6 +31,7 @@ * [Templating](templating/README.md) * [Content References](templating/conrefs.md) * [Variables](templating/variables.md) + * [Builtin](templating/builtin.md) * [Plugins](plugins/README.md) * [Create a plugin](plugins/create.md) * [Hooks](plugins/hooks.md) diff --git a/docs/plugins/api.md b/docs/plugins/api.md index c5a17b3..135f196 100644 --- a/docs/plugins/api.md +++ b/docs/plugins/api.md @@ -12,6 +12,14 @@ var value = book.config.get('title', 'Default Value'); // Resolve a filename to an absolute path var filepath = book.resolve('README.md'); + +// Render an inline markup string +book.renderInline('markdown', 'This is **Markdown**') + .then(function(str) { ... }) + +// Render a markup string (block mode) +book.renderBlock('markdown', '* This is **Markdown**') + .then(function(str) { ... }) ``` #### Output instance diff --git a/docs/templating/builtin.md b/docs/templating/builtin.md new file mode 100644 index 0000000..1f05edf --- /dev/null +++ b/docs/templating/builtin.md @@ -0,0 +1,18 @@ +# Builtin Templating Helpers + +GitBook provides a serie of builtin filters and blocks to help you write templates. + +### Filters + +`value|default(default, [boolean])`If value is strictly undefined, return default, otherwise value. If boolean is true, any JavaScript falsy value will return default (false, "", etc) + +`arr|sort(reverse, caseSens, attr)` +Sort arr with JavaScript's arr.sort function. If reverse is true, result will be reversed. Sort is case-insensitive by default, but setting caseSens to true makes it case-sensitive. If attr is passed, will compare attr from each item. + +### Blocks + +`{% markdown %}Markdown string{% endmarkdown %}` +Render inline markdown + +`{% asciidoc %}AsciiDoc string{% endasciidoc %}` +Render inline asciidoc |