diff options
Diffstat (limited to 'lib/parsers/asciidoc.js')
-rw-r--r-- | lib/parsers/asciidoc.js | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/lib/parsers/asciidoc.js b/lib/parsers/asciidoc.js new file mode 100644 index 0000000..84e619d --- /dev/null +++ b/lib/parsers/asciidoc.js @@ -0,0 +1,27 @@ +var Asciidoctor = require('asciidoctor.js'); +var htmlParser = require('./html'); + +var asciidoctor = Asciidoctor(); +var opal = asciidoctor.Opal; + +var processor = null; +var useExtensions = true; + +if (useExtensions) { + processor = asciidoctor.Asciidoctor(true); +} else { + processor = asciidoctor.Asciidoctor(); +} + + +// Convert asciidoc to HTML +function asciidocToHTML(content) { + var options = opal.hash2(['attributes'], {'attributes': 'showtitle'}); + return processor.$convert(content, options); +} + + +module.exports = htmlParser.inherits({ + extensions: ['.adoc', '.asciidoc'], + toHTML: asciidocToHTML +}); |