summaryrefslogtreecommitdiffstats
path: root/packages/gitbook-asciidoc/src/toHTML.js
diff options
context:
space:
mode:
authorSamy Pessé <samypesse@gmail.com>2016-12-22 12:31:22 +0100
committerSamy Pessé <samypesse@gmail.com>2016-12-22 12:31:22 +0100
commiteb0bf31baa6cb903ba4242ae5a3866ff67aeb97c (patch)
treee2347c9e8c58dd3c2681a6028b5f8d69c40d4e04 /packages/gitbook-asciidoc/src/toHTML.js
parent1c1e58b8641cac34b5f3d7c05951f507557fcb1a (diff)
downloadgitbook-eb0bf31baa6cb903ba4242ae5a3866ff67aeb97c.zip
gitbook-eb0bf31baa6cb903ba4242ae5a3866ff67aeb97c.tar.gz
gitbook-eb0bf31baa6cb903ba4242ae5a3866ff67aeb97c.tar.bz2
Import gitbook-asciidoc
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
+};