@asciidoctor/core
    Preparing search index...

    Class Processor

    Abstract base class for document and syntax processors.

    Provides a class-level config map (via static config / static option) and a set of convenience factory methods for creating AST nodes.

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    config: any

    Accessors

    • get config(): object

      Get the static configuration map for this processor class. Uses hasOwnProperty to avoid inheriting a parent class's config object through the prototype chain when a subclass first accesses config.

      Returns object

    Methods

    • Create a generic block node and link it to the specified parent.

      Parameters

      • parent: Section | Block

        The parent node.

      • context: string

        The block context (e.g. 'paragraph', 'listing').

      • source: string | string[]

        The source content.

      • attrs: object

        A plain object of attributes.

      • Optionalopts: object

        An optional plain object of options.

      Returns Block

      a Block node with all properties properly initialized.

    • Create an image block node and link it to the specified parent.

      Parameters

      • parent: Document | Section | Block

        The parent of this new image block.

      • attrs: object

        A plain object of attributes to control how the image block is built. The target attribute sets the image source; alt sets the alt text.

      • Optionalopts: object

        An optional plain object of options.

      Returns Block

      a Block node with all properties properly initialized.

    • Create an inline node and bind it to the specified parent.

      Parameters

      • parent: Block

        The parent Block of this new inline node.

      • context: string

        The context of the inline node ('quoted', 'anchor', etc.).

      • text: string

        The text of the inline node.

      • Optionalopts: object

        An optional plain object of options:

        • type {string} - The subtype of the inline node context.
        • attributes {object} - Attributes to set on the inline node.

      Returns Inline

      an Inline node with all properties properly initialized.

    • Create a list node and link it to the specified parent.

      Parameters

      • parent: Document | Section | Block

        The parent of this new list.

      • context: string

        The list context ('ulist', 'olist', 'colist', 'dlist').

      • Optionalattrs: object

        A plain object of attributes to set on this list block.

      Returns List

      a List node with all properties properly initialized.

    • Create a list item node and link it to the specified parent.

      Parameters

      • parent: List

        The parent List of this new list item.

      • Optionaltext: string

        The text of the list item.

      Returns ListItem

      a ListItem node with all properties properly initialized.

    • Create a Section node in the same manner as the parser.

      Parameters

      • parent: Document | Section

        The parent Section or Document of this new Section.

      • title: string

        The String title of the new Section.

      • attrs: object

        A plain object of attributes to control how the section is built. Use the style attribute to set the name of a special section (e.g. appendix). Use the id attribute to assign an explicit ID, or set it to false to disable automatic ID generation (when sectids document attribute is set).

      • Optionalopts: object

        An optional plain object of options:

        • level {number} - The Integer level to assign; defaults to parent.level + 1.
        • numbered {boolean} - Flag to force numbering.

      Returns Section

      a Section node with all properties properly initialized.

    • Parse the attrlist String into a plain object of attributes.

      Parameters

      • block: Section | Block

        The current block (used for applying subs).

      • attrlist: string

        The list of attributes as a String.

      • Optionalopts: object

        An optional plain object of options:

        • positional_attributes {string[]} - Array of attribute names to map positional args to.
        • sub_attributes {boolean} - Enables attribute substitution on attrlist.

      Returns Promise<object>

      a plain object of parsed attributes.

    • Parse blocks in the content and attach them to the parent.

      Parameters

      • parent: Section | Block

        The parent node.

      • content: string[] | Reader

        Lines or a Reader.

      • Optionalattributes: object

        Attributes to pass to the parser.

      Returns Promise<Section | Block>

      the parent node into which the blocks are parsed.

    • Parameters

      • ..._args: any[]

      Returns void

    • Mix the DSL object for this processor class into its prototype.

      Returns void

    • Set a default option value for all instances of this processor class.

      Parameters

      • key: string

        The option key.

      • value: any

        The option value.

      Returns void