diff options
author | Samy Pessé <samypesse@gmail.com> | 2016-03-18 10:27:49 +0100 |
---|---|---|
committer | Samy Pessé <samypesse@gmail.com> | 2016-12-22 11:46:24 +0100 |
commit | 1f95fa02bc760fb3d0301f208bb03d2858075f43 (patch) | |
tree | aff21cf3643342d722ac18b65423a8ddbdb173a3 /packages/gitbook-asciidoc/lib | |
parent | a9f6ad173414cfae74169d89f7aedd1c6148430c (diff) | |
download | gitbook-1f95fa02bc760fb3d0301f208bb03d2858075f43.zip gitbook-1f95fa02bc760fb3d0301f208bb03d2858075f43.tar.gz gitbook-1f95fa02bc760fb3d0301f208bb03d2858075f43.tar.bz2 |
Add inline renderer
Diffstat (limited to 'packages/gitbook-asciidoc/lib')
-rw-r--r-- | packages/gitbook-asciidoc/lib/tohtml.js | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/packages/gitbook-asciidoc/lib/tohtml.js b/packages/gitbook-asciidoc/lib/tohtml.js index 80cbb89..46203e4 100644 --- a/packages/gitbook-asciidoc/lib/tohtml.js +++ b/packages/gitbook-asciidoc/lib/tohtml.js @@ -2,7 +2,7 @@ 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'}); @@ -10,4 +10,15 @@ function asciidocToHTML(content) { return html; }; -module.exports = asciidocToHTML; +// 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 +}; |