summaryrefslogtreecommitdiffstats
path: root/packages/gitbook-asciidoc/lib/tohtml.js
blob: 46203e404a2c596e284720c5c13682af808331da (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
var asciidoctor = require('asciidoctor.js')();
var opal = asciidoctor.Opal;
var processor = asciidoctor.Asciidoctor(true);

// Render Asciidoc to HTML (block)
function asciidocToHTML(content) {
    var options = opal.hash2(['attributes'], {'attributes': 'showtitle'});

    var html = processor.$convert(content, options);
    return html;
};

// Render Asciidoc to HTML (inline)
function asciidocToHTMLInline(content) {
    var options = Opal.hash({doctype: 'inline', attributes: ['showtitle']});

    var html = processor.$convert(content, options);
    return html;
};

module.exports = {
    block: asciidocToHTML,
    inline: asciidocToHTMLInline
};