This documentation covers a prerelease version of the software. Follow this link to view the documentation for the stable version (4.0) instead.

Adding an external extension

If an AsciidoctorJ extension is not already supported in this plugin suite, there is a there is a special extension of type AsciidoctorjGenericExtension.

  • Groovy

import org.asciidoctor.gradle.model5.jvm.extensions.AsciidoctorjGenericExtension
import org.asciidoctor.gradle.model5.jvm.toolchains.AsciidoctorjToolchain

asciidoc {
  toolchains {
    asciidoctorj.asciidocExtensions {
      myBackend(AsciidoctorjGenericExtension) {
        attributes( foo_color : 'black') (1)
        requires 'foo' (2)
        useGem 'foo', '1.2.3' (3)
        useModule( 'acme.foo:foo', '1.2.3') (4)
        useModule( dependencies.project(':my-backend')) (5)
      }
    }
  }
}
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 If the extension is only available as a GEM, add the name of the GEM and its version. To use this option, the org.asciidoctor.jvm.gems must be applied.
4 If the extension is available as a JAR artifact from a Maven or Ivy repository, provide the Maven module coordinates as well as something that will resolve to a version string.
5 If the extension is provided from the current project hierarchy, it can be referenced as a project dependency.