diff options
author | Samy Pessé <samypesse@gmail.com> | 2015-01-21 10:18:15 +0100 |
---|---|---|
committer | Samy Pessé <samypesse@gmail.com> | 2016-12-22 11:46:14 +0100 |
commit | a81a503ff0bbbf66f6fefb7090f8516071ae817a (patch) | |
tree | 5a255d8453a3c4705083c6a6a4eba2f76fee7acf /packages/gitbook-asciidoc/lib/utils/convert.js | |
parent | 11893255d1167382b16871d2ca831c90a40af57d (diff) | |
download | gitbook-a81a503ff0bbbf66f6fefb7090f8516071ae817a.zip gitbook-a81a503ff0bbbf66f6fefb7090f8516071ae817a.tar.gz gitbook-a81a503ff0bbbf66f6fefb7090f8516071ae817a.tar.bz2 |
Add base to parse asciidoc
Diffstat (limited to 'packages/gitbook-asciidoc/lib/utils/convert.js')
-rw-r--r-- | packages/gitbook-asciidoc/lib/utils/convert.js | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/packages/gitbook-asciidoc/lib/utils/convert.js b/packages/gitbook-asciidoc/lib/utils/convert.js new file mode 100644 index 0000000..8a19638 --- /dev/null +++ b/packages/gitbook-asciidoc/lib/utils/convert.js @@ -0,0 +1,21 @@ +var asciidoctor = require('asciidoctor.js')(); +var opal = asciidoctor.Opal; + +var processor = null; +var useExtensions = true; + +if (useExtensions) { + processor = asciidoctor.Asciidoctor(true); +} else { + processor = asciidoctor.Asciidoctor(); +} + + +var convert = function(content) { + var options = opal.hash2(['attributes'], {'attributes': 'showtitle'}); + + var html = processor.$convert(content, options); + return html; +}; + +module.exports = convert; |