summaryrefslogtreecommitdiffstats
path: root/packages/gitbook-asciidoc/src/toHTML.js
blob: 0fc8f5f70608d554f480e9c252c28f12f0042b5d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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
};