diff options
author | Samy Pessé <samypesse@gmail.com> | 2016-05-02 16:20:10 +0200 |
---|---|---|
committer | Samy Pessé <samypesse@gmail.com> | 2016-12-22 11:46:25 +0100 |
commit | 13414c27eb3d12fdbeb3dd35dccf45d579e1e637 (patch) | |
tree | 6d59c1d83e8867650abcee362d22b5121c5f8a14 /packages/gitbook-asciidoc/lib/toHTML.js | |
parent | c5aad7ee5558faef3ddce930cf8856b57e71e37d (diff) | |
download | gitbook-13414c27eb3d12fdbeb3dd35dccf45d579e1e637.zip gitbook-13414c27eb3d12fdbeb3dd35dccf45d579e1e637.tar.gz gitbook-13414c27eb3d12fdbeb3dd35dccf45d579e1e637.tar.bz2 |
Adapt to gitbook@html@1.2.*
Diffstat (limited to 'packages/gitbook-asciidoc/lib/toHTML.js')
-rw-r--r-- | packages/gitbook-asciidoc/lib/toHTML.js | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/packages/gitbook-asciidoc/lib/toHTML.js b/packages/gitbook-asciidoc/lib/toHTML.js new file mode 100644 index 0000000..46203e4 --- /dev/null +++ b/packages/gitbook-asciidoc/lib/toHTML.js @@ -0,0 +1,24 @@ +var asciidoctor = require('asciidoctor.js')(); +var opal = asciidoctor.Opal; +var processor = asciidoctor.Asciidoctor(true); + +// Render Asciidoc to HTML (block) +function asciidocToHTML(content) { + var options = opal.hash2(['attributes'], {'attributes': 'showtitle'}); + + var html = processor.$convert(content, options); + return html; +}; + +// Render Asciidoc to HTML (inline) +function asciidocToHTMLInline(content) { + var options = Opal.hash({doctype: 'inline', attributes: ['showtitle']}); + + var html = processor.$convert(content, options); + return html; +}; + +module.exports = { + block: asciidocToHTML, + inline: asciidocToHTMLInline +}; |