summaryrefslogtreecommitdiffstats
path: root/packages/gitbook-asciidoc
diff options
context:
space:
mode:
Diffstat (limited to 'packages/gitbook-asciidoc')
-rw-r--r--packages/gitbook-asciidoc/lib/tohtml.js15
-rwxr-xr-xpackages/gitbook-asciidoc/package.json2
-rw-r--r--packages/gitbook-asciidoc/test/inline.js11
3 files changed, 25 insertions, 3 deletions
diff --git a/packages/gitbook-asciidoc/lib/tohtml.js b/packages/gitbook-asciidoc/lib/tohtml.js
index 80cbb89..46203e4 100644
--- a/packages/gitbook-asciidoc/lib/tohtml.js
+++ b/packages/gitbook-asciidoc/lib/tohtml.js
@@ -2,7 +2,7 @@ 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'});
@@ -10,4 +10,15 @@ function asciidocToHTML(content) {
return html;
};
-module.exports = asciidocToHTML;
+// 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
+};
diff --git a/packages/gitbook-asciidoc/package.json b/packages/gitbook-asciidoc/package.json
index 5e31736..c4f35b1 100755
--- a/packages/gitbook-asciidoc/package.json
+++ b/packages/gitbook-asciidoc/package.json
@@ -7,7 +7,7 @@
"dependencies": {
"lodash": "^3.2.0",
"asciidoctor.js": "1.5.5-1",
- "gitbook-html": "1.0.2"
+ "gitbook-html": "1.1.0"
},
"devDependencies": {
"mocha": "2.3.2"
diff --git a/packages/gitbook-asciidoc/test/inline.js b/packages/gitbook-asciidoc/test/inline.js
new file mode 100644
index 0000000..17d66a3
--- /dev/null
+++ b/packages/gitbook-asciidoc/test/inline.js
@@ -0,0 +1,11 @@
+var fs = require('fs');
+var path = require('path');
+var assert = require('assert');
+
+var inline = require('../').inline;
+
+describe('Inline', function () {
+ it('should render inline AsciiDoc', function() {
+ assert.equal(inline('Hello **World**').content, 'Hello <strong>World</strong>');
+ });
+});