Adding an external extension

If an Asciidoctor.js extension is not already supported in this plugin suite, there is a there is a special extension of type AsciidoctorjsGenericExtension.

  • Groovy

import org.asciidoctor.gradle.model5.js.extensions.AsciidoctorjsGenericExtension

asciidoc {
  toolchains {
    asciidoctorjs.asciidocExtensions {
      myBackend(AsciidoctorjsGenericExtension) {
        attributes( foo_color : 'black') (1)
        requires 'foo' (2)
        usePackage( 'asciidoctor', 'foo', '1.2.3') (3)
        usePackage( 'asciidoctor-emoji', '1.2.3') (4)
      }
    }
  }
}
1 Set the specific attributes that this extension might require.
2 If one or more requires need to be passed to the engine, define them here.
3 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.
4 A two-parameter version if the package is scope-less.