The HTML output formatter
HTML output is the most common usage of Asciidoctor.js and is also bundled with org.asciidoctor.js
.
There are a number of items that can be configured on the output formatter itself.
import org.asciidoctor.gradle.model5.js.formatters.AsciidoctorjsHtml
asciidoc {
toolchains {
aciidoctorj {
registeredOutputFormatters {
html(AsciidoctorjsHtml) { (1)
embedded = true (2)
templateDirs 'src/myAsciidocTemplate1', 'src/myAsciidocTemplate2' (3)
useEngine 'nunjucks' (4)
useEngine 'handlebars', '1.2.3'(5)
}
}
}
}
}
1 | The org.asciidoctor.jvm plugin adds an HTML output formatter called html . |
2 | Output an embeddable document, which excludes the header, the footer, and everything outside the body of the document. This option is useful for producing documents that can be inserted into an external template. |
3 | Define one or more templates that can be used for conversion. |
4 | Adds an engine from NPM using the default version.
Only ejs , handlebars , js , nunjucks and pug are supported.
js is a NOOP as template-js is a built-in. |
5 | Adds an engine from NPM using the specified version. |
templateDirs Must be provided, otherwise template setting will be ignored.
It will auto-detect engines from the file extensions found in the template directories.
|