summaryrefslogtreecommitdiffstats
path: root/packages/gitbook-asciidoc/src/toHTML.js
diff options
context:
space:
mode:
Diffstat (limited to 'packages/gitbook-asciidoc/src/toHTML.js')
-rw-r--r--packages/gitbook-asciidoc/src/toHTML.js24
1 files changed, 24 insertions, 0 deletions
diff --git a/packages/gitbook-asciidoc/src/toHTML.js b/packages/gitbook-asciidoc/src/toHTML.js
new file mode 100644
index 0000000..0fc8f5f
--- /dev/null
+++ b/packages/gitbook-asciidoc/src/toHTML.js
@@ -0,0 +1,24 @@
+const asciidoctor = require('asciidoctor.js')();
+
+/**
+ * Render Asciidoc to HTML (block)
+ * @param {String} content
+ * @return {String} html
+ */
+function asciidocToHTML(content) {
+ return asciidoctor.convert(content, {'attributes': 'showtitle'});
+}
+
+/**
+ * Render Asciidoc to HTML (inline)
+ * @param {String} content
+ * @return {String} html
+ */
+function asciidocToHTMLInline(content) {
+ return asciidoctor.convert(content, {doctype: 'inline', attributes: 'showtitle'});
+}
+
+module.exports = {
+ block: asciidocToHTML,
+ inline: asciidocToHTMLInline
+};