@asciidoctor/core
    Preparing search index...

    Class Registry

    The primary entry point into the extension system.

    Registry holds the extensions which have been registered and activated, has methods for registering or defining a processor and looks up extensions stored in the registry during parsing.

    Index

    Constructors

    Properties

    document: any
    groups: {}

    Methods

    • Activate all global extension Groups and the Groups associated with this registry.

      Parameters

      • document: Document

        The Document on which the extensions are to be used.

      Returns Registry

      this Registry.

    • Register a BlockProcessor with the extension registry.

      Parameters

      • ...args: any[]

        Class constructor, instance, block function, or name + one of those.

      Returns ProcessorExtension

      an Extension proxy object.

      // class style
      block(ShoutBlock)
      // class style with explicit name
      block(ShoutBlock, 'shout')
      // block style
      block(function () {
      this.named('shout')
      this.process(function (parent, reader, attrs) { ... })
      })
      // block style with explicit name
      block('shout', function () {
      this.process(function (parent, reader, attrs) { ... })
      })
    • Register a DocinfoProcessor with the extension registry.

      Parameters

      • ...args: any[]

        Class constructor, instance, or block function.

      Returns ProcessorExtension

      the Extension stored in the registry.

    • Retrieve Extension proxy objects for DocinfoProcessor instances.

      Parameters

      • Optionallocation: string

        Optional location ('head' or 'footer') to filter by.

      Returns ProcessorExtension[]

      array of Extension proxy objects.

    • Check whether any BlockMacroProcessor extensions have been registered.

      Returns boolean

    • Check whether any BlockProcessor extensions have been registered.

      Returns boolean

    • Check whether any DocinfoProcessor extensions have been registered.

      Parameters

      • Optionallocation: string

        Optional location ('head' or 'footer') to filter by.

      Returns boolean

    • Check whether any IncludeProcessor extensions have been registered.

      Returns boolean

    • Check whether any InlineMacroProcessor extensions have been registered.

      Returns boolean

    • Check whether any Postprocessor extensions have been registered.

      Returns boolean

    • Check whether any Preprocessor extensions have been registered.

      Returns boolean

    • Check whether any TreeProcessor extensions have been registered.

      Returns boolean

    • Register an IncludeProcessor with the extension registry.

      Parameters

      • ...args: any[]

        Class constructor, instance, or block function.

      Returns ProcessorExtension

      the Extension stored in the registry.

    • Register an InlineMacroProcessor with the extension registry.

      Parameters

      • ...args: any[]

        Class constructor, instance, or block function.

      Returns ProcessorExtension

      the Extension stored in the registry.

    • Insert the document-processor Extension as the first of its kind in the extension registry.

      Parameters

      • ...args: any[]

        A ProcessorExtension, or a method name followed by processor args.

      Returns ProcessorExtension

      the Extension stored in the registry.

      registry.prefer('includeProcessor', function () {
      this.process(function (document, reader, target, attrs) { ... })
      })
    • Register a Preprocessor with the extension registry.

      The processor may be:

      • A Preprocessor subclass (constructor function)
      • An instance of a Preprocessor subclass
      • A Function that configures the processor via the DSL (block style)

      Parameters

      • ...args: any[]

        Class constructor, instance, or block function.

      Returns ProcessorExtension

      the Extension stored in the registry.

      // class style
      preprocessor(FrontMatterPreprocessor)
      // instance style
      preprocessor(new FrontMatterPreprocessor())
      // block style
      preprocessor(function () {
      this.process(function (doc, reader) { ... })
      })
    • Check whether a BlockProcessor is registered for the given name and context.

      Parameters

      • name: string

        The block name.

      • context: string

        The block context.

      Returns false | ProcessorExtension

      the Extension proxy or false.