Adding an external backend as an output formatter
Although the popular Asciidoctor.js backends are supported in this plugin suite, there is a good chance that one might want to use a backend that is not directly supported.
For this there is a special output formatter of type AsciidoctorjsGenericOutputFormatter
.
import org.asciidoctor.gradle.model5.js.formatters.AsciidoctorjsGenericOutputFormatter
asciidoc {
toolchains {
asciidoctorjs.registeredOutputFormatters {
myBackend(AsciidoctorjsGenericOutputFormatter) {
backend = 'foo' (1)
attributes( foo_color : 'black') (2)
copyResources = false (3)
enforcedDocType = 'book' (4)
requires 'foo' (5)
usePackage( 'asciidoctor', 'foo', '1.2.3') (6)
}
}
}
}
1 | Set the name of the backend |
2 | Set the specific attributes that this backend might require. |
3 | Set whether the backend should copy resources. |
4 | If the backend requires a specific kind of document type, set it here, otherwise leave it alone. |
5 | If one or more requires need to be passed to the engine, define them here. |
6 | Add the NPM package details.
The first parameter is the scope and can be passed as null .
The second parameter is the package name.
The third parameter is something that can be lazy-evaluated to a version string. |