export namespace ProcessorDsl { function option(key: any, value: any): void; function process(...args: any[]): any; function processBlockGiven(): boolean; } export namespace DocumentProcessorDsl { function prefer(): void; /** Alias for {@link prefer}. */ function prepend(): void; } export namespace SyntaxProcessorDsl { function named(value: any): void; function contentModel(value: any): void; /** Alias for {@link contentModel}. */ function parseContentAs(value: any): void; function positionalAttributes(...value: any[]): void; /** Alias for {@link positionalAttributes}. */ function namePositionalAttributes(...value: any[]): void; function positionalAttrs(...value: any[]): void; function defaultAttributes(value: any): void; /** @deprecated Alias for {@link defaultAttributes}. */ function defaultAttrs(value: any): void; /** * Resolve and register positional attribute names and default values. * * Accepts any of: * resolveAttributes() → positionalAttrs: [], defaultAttrs: {} * resolveAttributes('foo', 'bar') → positional maps (Array-style) * resolveAttributes({...}) → positional maps (Object-style) * * Array-style tokens understand positional-index notation (e.g. '1:name', * '@:name') and default-value notation (e.g. 'name=value', '1:name=value'). * * @param {...*} args - Positional attribute specifications. */ function resolveAttributes(...args: any[]): void; /** @deprecated Alias for {@link resolveAttributes}. */ function resolvesAttributes(...args: any[]): void; } export namespace IncludeProcessorDsl { /** * @overload * @param {(target: string) => boolean} fn - Predicate that receives only the include target. * @returns {void} */ function handles(fn: (target: string) => boolean): void; /** * @overload * @param {(doc: Document, target: string) => boolean} fn - Predicate that receives the document and the include target. * @returns {void} */ function handles(fn: (doc: Document, target: string) => boolean): void; /** * @overload * @param {Document} doc - The document being parsed. * @param {string} target - The include target. * @returns {boolean} */ function handles(doc: Document, target: string): boolean; } export namespace DocinfoProcessorDsl { function atLocation(value: any): void; } export namespace BlockProcessorDsl { function contexts(...value: any[]): void; function onContexts(...value: any[]): void; function onContext(...value: any[]): void; function bindTo(...value: any[]): void; } export namespace MacroProcessorDsl { /** * Override: passing a falsy value sets contentModel to 'text' instead of * configuring positional attributes. * * @param {...*} args - Positional attribute specifications. */ function resolveAttributes(...args: any[]): void; /** @deprecated Alias for {@link resolveAttributes}. */ function resolvesAttributes(...args: any[]): void; } export namespace InlineMacroProcessorDsl { function format(value: any): void; /** Alias for {@link format}. */ function matchFormat(value: any): void; /** @deprecated Alias for {@link format}. */ function usingFormat(value: any): void; function match(value: any): void; } /** * 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. */ export class Processor { /** * Replace the static configuration map for this processor class, e.g. * `ShoutBlock.config = { name: 'shout', contentModel: 'simple' }`. * * @param {object} value */ static set config(value: 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} */ static get config(): object; /** * Set a default option value for all instances of this processor class. * * @param {string} key - The option key. * @param {*} value - The option value. */ static option(key: string, value: any): void; /** * Mix the DSL object for this processor class into its prototype. */ static enableDsl(): void; /** Alias for {@link enableDsl}. */ static useDsl(): void; constructor(config?: {}); config: any; updateConfig(config: any): void; process(..._args: any[]): void; /** * Create a Section node in the same manner as the parser. * * @param {Section|Document} parent - The parent Section or Document of this new Section. * @param {string} title - The String title of the new Section. * @param {object} attrs - 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). * @param {object} [opts={}] - 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. */ createSection(parent: Section | Document, title: string, attrs: object, opts?: object): Section; /** * Create a generic block node and link it to the specified parent. * * @param {Block|Section} parent - The parent node. * @param {string} context - The block context (e.g. 'paragraph', 'listing'). * @param {string|string[]|null} source - The source content. * @param {object} attrs - A plain object of attributes. * @param {object} [opts={}] - An optional plain object of options. * @returns {Block} a Block node with all properties properly initialized. */ createBlock(parent: Block | Section, context: string, source: string | string[] | null, attrs: object, opts?: object): Block; /** * Create a list node and link it to the specified parent. * * @param {Block|Section|Document} parent - The parent of this new list. * @param {string} context - The list context ('ulist', 'olist', 'colist', 'dlist'). * @param {object|null} [attrs=null] - A plain object of attributes to set on this list block. * @returns {List} a List node with all properties properly initialized. */ createList(parent: Block | Section | Document, context: string, attrs?: object | null): List; /** * Create a list item node and link it to the specified parent. * * @param {List} parent - The parent List of this new list item. * @param {string|null} [text=null] - The text of the list item. * @returns {ListItem} a ListItem node with all properties properly initialized. */ createListItem(parent: List, text?: string | null): ListItem; /** * Create an image block node and link it to the specified parent. * * @param {Block|Section|Document} parent - The parent of this new image block. * @param {object} attrs - 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. * @param {object} [opts={}] - An optional plain object of options. * @returns {Block} a Block node with all properties properly initialized. */ createImageBlock(parent: Block | Section | Document, attrs: object, opts?: object): Block; /** * Create an inline node and bind it to the specified parent. * * @param {Block} parent - The parent Block of this new inline node. * @param {string} context - The context of the inline node ('quoted', 'anchor', etc.). * @param {string} text - The text of the inline node. * @param {object} [opts={}] - 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. */ createInline(parent: Block, context: string, text: string, opts?: object): Inline; /** * Parse blocks in the content and attach them to the parent. * * @param {Block|Section} parent - The parent node. * @param {string[]|Reader} content - Lines or a Reader. * @param {object|null} [attributes=null] - Attributes to pass to the parser. * @returns {Promise} the parent node into which the blocks are parsed. */ parseContent(parent: Block | Section, content: string[] | Reader, attributes?: object | null): Promise; /** * Parse the attrlist String into a plain object of attributes. * * @param {Block|Section} block - The current block (used for applying subs). * @param {string} attrlist - The list of attributes as a String. * @param {object} [opts={}] - 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} a plain object of parsed attributes. */ parseAttributes(block: Block | Section, attrlist: string, opts?: object): Promise; /** Shorthand for {@link createBlock} with context 'paragraph'. */ createParagraph(parent: any, ...rest: any[]): Block; /** Shorthand for {@link createBlock} with context 'open'. */ createOpenBlock(parent: any, ...rest: any[]): Block; /** Shorthand for {@link createBlock} with context 'example'. */ createExampleBlock(parent: any, ...rest: any[]): Block; /** Shorthand for {@link createBlock} with context 'pass'. */ createPassBlock(parent: any, ...rest: any[]): Block; /** Shorthand for {@link createBlock} with context 'listing'. */ createListingBlock(parent: any, ...rest: any[]): Block; /** Shorthand for {@link createBlock} with context 'literal'. */ createLiteralBlock(parent: any, ...rest: any[]): Block; /** Shorthand for {@link createInline} with context 'anchor'. */ createAnchor(parent: any, ...rest: any[]): Inline; /** Shorthand for {@link createInline} with context 'quoted'. */ createInlinePass(parent: any, ...rest: any[]): Inline; } /** * Preprocessors are run after the source text is split into lines and * normalised, but before parsing begins. * * Asciidoctor passes the document and the document's Reader to the process * method of the Preprocessor instance. The Preprocessor can modify the Reader * as necessary and either return the same Reader (or falsy) or a substitute Reader. * * Implementations must extend Preprocessor and override {@link process}. * * @example * class CommentStripPreprocessor extends Preprocessor { * process(document, reader) { * const lines = reader.getLines().filter((l) => !l.startsWith('//')) * reader.pushInclude(lines, null, null, 1, {}) * return reader * } * } * // Register: * Extensions.register(function () { this.preprocessor(CommentStripPreprocessor) }) */ export class Preprocessor extends Processor { /** * @param {Document} document - The document being parsed. * @param {PreprocessorReader} reader - The reader positioned at the beginning of the source. * @returns {Reader|undefined} The same or a substitute Reader, or undefined to use the original. */ process(document: Document, reader: PreprocessorReader): Reader | undefined; } export namespace Preprocessor { export { DocumentProcessorDsl as DSL }; } /** * TreeProcessors are run on the Document after the source has been * parsed into an abstract syntax tree (AST). * * Implementations must extend TreeProcessor and override {@link process}. * * @example * class ShoutTreeProcessor extends TreeProcessor { * process(document) { * for (const block of document.findBy({ context: 'paragraph' })) { * block.source = block.source.toUpperCase() * } * } * } * Extensions.register(function () { this.treeProcessor(ShoutTreeProcessor) }) */ export class TreeProcessor extends Processor { /** * @param {Document} document - The parsed document. * @returns {void} */ process(document: Document): void; } export namespace TreeProcessor { export { DocumentProcessorDsl as DSL }; } /** @deprecated Alias for {@link TreeProcessor} kept for backwards compatibility. */ export const Treeprocessor: typeof TreeProcessor; /** * Postprocessors are run after the document is converted, but before * it is written to the output stream. * * The `process` method receives the document and the converted output string, and * must return the (possibly modified) output string. * * Implementations must extend Postprocessor and override {@link process}. * * @example * class FooterPostprocessor extends Postprocessor { * process(document, output) { * return output.replace('', '
Generated by Acme
') * } * } * Extensions.register(function () { this.postprocessor(FooterPostprocessor) }) */ export class Postprocessor extends Processor { /** * @param {Document} document - The converted document. * @param {string} output - The converted output string. * @returns {string} The (possibly modified) output string. */ process(document: Document, output: string): string; } export namespace Postprocessor { export { DocumentProcessorDsl as DSL }; } /** * IncludeProcessors handle include::[] directives. * * Implementations must extend IncludeProcessor. */ export class IncludeProcessor extends Processor { /** * @param {Document} document - The document being parsed. * @param {PreprocessorReader} reader - The reader for the including document. * @param {string} target - The target of the include directive. * @param {Record} attributes - The parsed include attributes. * @returns {void} */ process(document: Document, reader: PreprocessorReader, target: string, attributes: Record): void; /** * Decide whether this include processor handles the given target. * * Override this method in a subclass. The override may accept either just the * target string (Ruby-style, arity 1) or both the document and the target * (arity 2) — an arity-1 override is adapted at registration time so the * parser can always invoke it as `handles(doc, target)`. The first parameter * is therefore typed `Document | string` so both override shapes type-check. * * @param {Document|string} doc - The document being parsed, or (for a Ruby-style arity-1 override) the include target. * @param {string} target - The target of the include directive. * @returns {boolean} true if this processor handles the given target. */ handles(doc: Document | string, target: string): boolean; } export namespace IncludeProcessor { export { IncludeProcessorDsl as DSL }; } /** * DocinfoProcessors add additional content to the header and/or footer * of the generated document. * * Implementations must extend DocinfoProcessor. */ export class DocinfoProcessor extends Processor { /** * @param {Document} document - The document being converted. * @returns {string} The docinfo content to inject into the document. */ process(document: Document): string; } export namespace DocinfoProcessor { export { DocinfoProcessorDsl as DSL }; } /** * BlockProcessors handle delimited blocks and paragraphs with a custom name. * * The `process(parent, reader, attributes)` method receives: * - `parent` {AbstractBlock} — the enclosing block * - `reader` {Reader} — positioned at the block content * - `attributes` {Object} — parsed block attributes * * It must return a block node (created with `this.createBlock(...)`, etc.) * or call `this.parseContent(parent, reader)` to delegate parsing. * * Use the static `config` object or the DSL helpers (`contexts()`, * `contentModel()`, `resolveAttributes()`, …) to declare the block's behaviour * before registering. * * Implementations must extend BlockProcessor and override {@link process}. * * @example Custom delimited block that wraps content in a div * class ShoutBlock extends BlockProcessor { * static config = { name: 'shout', contexts: ['paragraph'], contentModel: 'simple' } * process(parent, reader, attrs) { * const block = this.createBlock(parent, 'paragraph', reader.readLines().join('\n').toUpperCase(), attrs) * return block * } * } * Extensions.register(function () { this.block(ShoutBlock) }) * // AsciiDoc usage: [shout]\nHello world */ export class BlockProcessor extends Processor { constructor(name?: any, config?: {}); name: any; /** * @param {AbstractBlock} parent - The enclosing block. * @param {Reader} reader - The reader positioned at the block content. * @param {Record} attributes - The parsed block attributes. * @returns {Block|void} A block node, or void to let the parser handle it. */ process(parent: AbstractBlock, reader: Reader, attributes: Record): Block | void; } export namespace BlockProcessor { export { BlockProcessorDsl as DSL }; } /** * Base class shared by BlockMacroProcessor and InlineMacroProcessor. */ export class MacroProcessor extends Processor { constructor(name?: any, config?: {}); name: any; /** * @param {AbstractBlock} parent - The enclosing block. * @param {string} target - The macro target (text between `name:` and `[`). * @param {Record} attributes - The parsed macro attributes. * @returns {Block|Inline|void} */ process(parent: AbstractBlock, target: string, attributes: Record): Block | Inline | void; } /** * BlockMacroProcessors handle block macros with a custom name. * * The `process(parent, target, attributes)` method receives: * - `parent` {AbstractBlock} — the enclosing block * - `target` {string} — the macro target (text between `name:` and `[`) * - `attributes` {Object} — parsed macro attributes * * It must return a block node created with one of the `createBlock`, * `createImage`, etc. helpers inherited from {@link Processor}. * * Implementations must extend BlockMacroProcessor and override {@link process}. * * @example Block macro that embeds a GitHub Gist * class GistBlockMacro extends BlockMacroProcessor { * process(parent, target, attrs) { * const html = `` * return this.createBlock(parent, 'pass', html) * } * } * GistBlockMacro.config = { name: 'gist' } * Extensions.register(function () { this.blockMacro(GistBlockMacro) }) * // AsciiDoc usage: gist::abc123[] */ export class BlockMacroProcessor extends MacroProcessor { _name: any; /** * @param {AbstractBlock} parent - The enclosing block. * @param {string} target - The macro target. * @param {Record} attributes - The parsed macro attributes. * @returns {Block} A block node created with one of the `createBlock` helpers. */ process(parent: AbstractBlock, target: string, attributes: Record): Block; } export namespace BlockMacroProcessor { export { MacroProcessorDsl as DSL }; } /** * InlineMacroProcessors handle inline macros with a custom name. * * The `process(parent, target, attributes)` method receives: * - `parent` {AbstractBlock} — the enclosing block * - `target` {string} — the macro target (text between `name:` and `[`) * - `attributes` {Object} — parsed macro attributes (first positional attr is `attributes[1]`) * * It must return an {@link Inline} node created with `this.createInline(parent, 'quoted', text, opts)`. * * By default the macro format is `'long'` (`name:target[attrs]`). Set * `config.format = 'short'` for a no-target form (`name:[attrs]`). * * Implementations must extend InlineMacroProcessor and override {@link process}. * * @example Inline macro that generates a keyboard shortcut span * class KbdInlineMacro extends InlineMacroProcessor { * process(parent, target, attrs) { * return this.createInline(parent, 'quoted', target, { type: 'monospaced' }) * } * } * KbdInlineMacro.config = { name: 'kbd', format: 'short' } * Extensions.register(function () { this.inlineMacro(KbdInlineMacro) }) * // AsciiDoc usage: kbd:[Ctrl+C] */ export class InlineMacroProcessor extends MacroProcessor { static rxCache: Map; /** * Look up (and memoize) the regexp for this inline macro processor. * * @returns {RegExp} */ get regexp(): RegExp; /** * @param {AbstractBlock} parent - The enclosing block. * @param {string} target - The macro target. * @param {Record} attributes - The parsed macro attributes. * @returns {Inline} An Inline node created with `this.createInline(...)`. */ process(parent: AbstractBlock, target: string, attributes: Record): Inline; resolveRegexp(name: any, format: any): any; } export namespace InlineMacroProcessor { export { InlineMacroProcessorDsl as DSL }; } /** * Proxy that encapsulates the extension kind, config, and instance. * This is what gets stored in the extension registry when activated. */ export class Extension { constructor(kind: any, instance: any, config: any); kind: any; instance: any; config: any; } /** * Specialisation of Extension that additionally stores a reference * to the process method, accommodating both class-based processors and function blocks. */ export class ProcessorExtension extends Extension { processMethod: any; } /** * A Group bundles one or more extension registrations that are re-executed on * every document conversion, making the registry safe to reuse. * * Subclass Group, override {@link Group#activate}, and either call * {@link Group.register} to add it globally or pass the subclass to * {@link Extensions.create} / {@link Extensions.register}. * * @example * class MyGroup extends Group { * activate (registry) { * registry.preprocessor(MyPreprocessor) * } * } * MyGroup.register() */ export class Group { /** * Register this Group class globally under the given name. * * Equivalent to calling `Extensions.register(name, this)`. * * @param {string|null} [name] - Optional name for the group. */ static register(name?: string | null): void; /** * Called by {@link Registry#activate} on every document conversion. * * Override this method to register extensions with the provided registry. * * @param {Registry} _registry - The registry to register extensions with. */ activate(_registry: Registry): void; } /** * 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. * * A registry can be reused across multiple conversions. Extensions registered * via a group block (passed to {@link Extensions.create} or * {@link Extensions.register}) are re-executed on every activation. Extensions * registered directly on the registry instance (e.g. `registry.preprocessor(fn)`) * are preserved across activations. * * @example * const registry = Extensions.create('my-ext', function () { * this.preprocessor(function () { ... }) * }) * // registry can be passed to multiple conversions safely */ export class Registry { constructor(groups?: {}); groups: {}; /** * Activate all global extension Groups and the Groups associated with this registry. * * @param {Document} document - The Document on which the extensions are to be used. * @returns {Registry} this Registry. */ activate(document: Document): Registry; document: import("./document.js").Document; /** * 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) * * @example * // class style * preprocessor(FrontMatterPreprocessor) * // instance style * preprocessor(new FrontMatterPreprocessor()) * // block style * preprocessor(function () { * this.process(function (doc, reader) { ... }) * }) * * @overload * @param {typeof Preprocessor} processor - A Preprocessor subclass. * @returns {ProcessorExtension} the Extension stored in the registry. * * @overload * @param {Preprocessor} processor - An already-constructed Preprocessor instance. * @returns {ProcessorExtension} the Extension stored in the registry. * * @overload * @param {(this: PreprocessorDslInterface) => void} fn - Registration function bound to the preprocessor DSL. * @returns {ProcessorExtension} the Extension stored in the registry. * * @param {...*} args - Class constructor, instance, or block function. * @returns {ProcessorExtension} the Extension stored in the registry. */ preprocessor(processor: typeof Preprocessor): ProcessorExtension; /** * 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) * * @example * // class style * preprocessor(FrontMatterPreprocessor) * // instance style * preprocessor(new FrontMatterPreprocessor()) * // block style * preprocessor(function () { * this.process(function (doc, reader) { ... }) * }) * * @overload * @param {typeof Preprocessor} processor - A Preprocessor subclass. * @returns {ProcessorExtension} the Extension stored in the registry. * * @overload * @param {Preprocessor} processor - An already-constructed Preprocessor instance. * @returns {ProcessorExtension} the Extension stored in the registry. * * @overload * @param {(this: PreprocessorDslInterface) => void} fn - Registration function bound to the preprocessor DSL. * @returns {ProcessorExtension} the Extension stored in the registry. * * @param {...*} args - Class constructor, instance, or block function. * @returns {ProcessorExtension} the Extension stored in the registry. */ preprocessor(processor: Preprocessor): ProcessorExtension; /** * 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) * * @example * // class style * preprocessor(FrontMatterPreprocessor) * // instance style * preprocessor(new FrontMatterPreprocessor()) * // block style * preprocessor(function () { * this.process(function (doc, reader) { ... }) * }) * * @overload * @param {typeof Preprocessor} processor - A Preprocessor subclass. * @returns {ProcessorExtension} the Extension stored in the registry. * * @overload * @param {Preprocessor} processor - An already-constructed Preprocessor instance. * @returns {ProcessorExtension} the Extension stored in the registry. * * @overload * @param {(this: PreprocessorDslInterface) => void} fn - Registration function bound to the preprocessor DSL. * @returns {ProcessorExtension} the Extension stored in the registry. * * @param {...*} args - Class constructor, instance, or block function. * @returns {ProcessorExtension} the Extension stored in the registry. */ preprocessor(fn: (this: PreprocessorDslInterface) => void): ProcessorExtension; /** * Return the registered Preprocessor extensions, or null if none. * * @returns {ProcessorExtension[]|null} */ preprocessors(): ProcessorExtension[] | null; /** * Check whether any Preprocessor extensions have been registered. * * @returns {boolean} */ hasPreprocessors(): boolean; /** * Register a TreeProcessor with the extension registry. * * @overload * @param {typeof TreeProcessor} processor - A TreeProcessor subclass. * @returns {ProcessorExtension} the Extension stored in the registry. * * @overload * @param {TreeProcessor} processor - An already-constructed TreeProcessor instance. * @returns {ProcessorExtension} the Extension stored in the registry. * * @overload * @param {(this: TreeProcessorDslInterface) => void} fn - Registration function bound to the tree processor DSL. * @returns {ProcessorExtension} the Extension stored in the registry. * * @param {...*} args - Class constructor, instance, or block function. * @returns {ProcessorExtension} the Extension stored in the registry. */ treeProcessor(processor: typeof TreeProcessor): ProcessorExtension; /** * Register a TreeProcessor with the extension registry. * * @overload * @param {typeof TreeProcessor} processor - A TreeProcessor subclass. * @returns {ProcessorExtension} the Extension stored in the registry. * * @overload * @param {TreeProcessor} processor - An already-constructed TreeProcessor instance. * @returns {ProcessorExtension} the Extension stored in the registry. * * @overload * @param {(this: TreeProcessorDslInterface) => void} fn - Registration function bound to the tree processor DSL. * @returns {ProcessorExtension} the Extension stored in the registry. * * @param {...*} args - Class constructor, instance, or block function. * @returns {ProcessorExtension} the Extension stored in the registry. */ treeProcessor(processor: TreeProcessor): ProcessorExtension; /** * Register a TreeProcessor with the extension registry. * * @overload * @param {typeof TreeProcessor} processor - A TreeProcessor subclass. * @returns {ProcessorExtension} the Extension stored in the registry. * * @overload * @param {TreeProcessor} processor - An already-constructed TreeProcessor instance. * @returns {ProcessorExtension} the Extension stored in the registry. * * @overload * @param {(this: TreeProcessorDslInterface) => void} fn - Registration function bound to the tree processor DSL. * @returns {ProcessorExtension} the Extension stored in the registry. * * @param {...*} args - Class constructor, instance, or block function. * @returns {ProcessorExtension} the Extension stored in the registry. */ treeProcessor(fn: (this: TreeProcessorDslInterface) => void): ProcessorExtension; /** @deprecated Alias for {@link treeProcessor}. */ treeprocessor(...args: any[]): ProcessorExtension; /** Alias for {@link treeProcessor} (snake_case for prefer() / Registry method dispatch). */ tree_processor(...args: any[]): ProcessorExtension; /** * Return the registered TreeProcessor extensions, or null if none. * * @returns {ProcessorExtension[]|null} */ treeProcessors(): ProcessorExtension[] | null; /** * Check whether any TreeProcessor extensions have been registered. * * @returns {boolean} */ hasTreeProcessors(): boolean; /** @deprecated Typo alias kept for backward compatibility. Use {@link hasTreeProcessors}. */ hasTeeProcessors(): boolean; /** @deprecated Alias for {@link treeProcessors}. */ treeprocessors(): any; /** * Register a Postprocessor with the extension registry. * * @overload * @param {typeof Postprocessor} processor - A Postprocessor subclass. * @returns {ProcessorExtension} the Extension stored in the registry. * * @overload * @param {Postprocessor} processor - An already-constructed Postprocessor instance. * @returns {ProcessorExtension} the Extension stored in the registry. * * @overload * @param {(this: PostprocessorDslInterface) => void} fn - Registration function bound to the postprocessor DSL. * @returns {ProcessorExtension} the Extension stored in the registry. * * @param {...*} args - Class constructor, instance, or block function. * @returns {ProcessorExtension} the Extension stored in the registry. */ postprocessor(processor: typeof Postprocessor): ProcessorExtension; /** * Register a Postprocessor with the extension registry. * * @overload * @param {typeof Postprocessor} processor - A Postprocessor subclass. * @returns {ProcessorExtension} the Extension stored in the registry. * * @overload * @param {Postprocessor} processor - An already-constructed Postprocessor instance. * @returns {ProcessorExtension} the Extension stored in the registry. * * @overload * @param {(this: PostprocessorDslInterface) => void} fn - Registration function bound to the postprocessor DSL. * @returns {ProcessorExtension} the Extension stored in the registry. * * @param {...*} args - Class constructor, instance, or block function. * @returns {ProcessorExtension} the Extension stored in the registry. */ postprocessor(processor: Postprocessor): ProcessorExtension; /** * Register a Postprocessor with the extension registry. * * @overload * @param {typeof Postprocessor} processor - A Postprocessor subclass. * @returns {ProcessorExtension} the Extension stored in the registry. * * @overload * @param {Postprocessor} processor - An already-constructed Postprocessor instance. * @returns {ProcessorExtension} the Extension stored in the registry. * * @overload * @param {(this: PostprocessorDslInterface) => void} fn - Registration function bound to the postprocessor DSL. * @returns {ProcessorExtension} the Extension stored in the registry. * * @param {...*} args - Class constructor, instance, or block function. * @returns {ProcessorExtension} the Extension stored in the registry. */ postprocessor(fn: (this: PostprocessorDslInterface) => void): ProcessorExtension; /** * Return the registered Postprocessor extensions, or null if none. * * @returns {ProcessorExtension[]|null} */ postprocessors(): ProcessorExtension[] | null; /** * Check whether any Postprocessor extensions have been registered. * * @returns {boolean} */ hasPostprocessors(): boolean; /** * Register an IncludeProcessor with the extension registry. * * @overload * @param {typeof IncludeProcessor} processor - An IncludeProcessor subclass. * @returns {ProcessorExtension} the Extension stored in the registry. * * @overload * @param {IncludeProcessor} processor - An already-constructed IncludeProcessor instance. * @returns {ProcessorExtension} the Extension stored in the registry. * * @overload * @param {(this: IncludeProcessorDslInterface) => void} fn - Registration function bound to the include processor DSL. * @returns {ProcessorExtension} the Extension stored in the registry. * * @param {...*} args - Class constructor, instance, or block function. * @returns {ProcessorExtension} the Extension stored in the registry. */ includeProcessor(processor: typeof IncludeProcessor): ProcessorExtension; /** * Register an IncludeProcessor with the extension registry. * * @overload * @param {typeof IncludeProcessor} processor - An IncludeProcessor subclass. * @returns {ProcessorExtension} the Extension stored in the registry. * * @overload * @param {IncludeProcessor} processor - An already-constructed IncludeProcessor instance. * @returns {ProcessorExtension} the Extension stored in the registry. * * @overload * @param {(this: IncludeProcessorDslInterface) => void} fn - Registration function bound to the include processor DSL. * @returns {ProcessorExtension} the Extension stored in the registry. * * @param {...*} args - Class constructor, instance, or block function. * @returns {ProcessorExtension} the Extension stored in the registry. */ includeProcessor(processor: IncludeProcessor): ProcessorExtension; /** * Register an IncludeProcessor with the extension registry. * * @overload * @param {typeof IncludeProcessor} processor - An IncludeProcessor subclass. * @returns {ProcessorExtension} the Extension stored in the registry. * * @overload * @param {IncludeProcessor} processor - An already-constructed IncludeProcessor instance. * @returns {ProcessorExtension} the Extension stored in the registry. * * @overload * @param {(this: IncludeProcessorDslInterface) => void} fn - Registration function bound to the include processor DSL. * @returns {ProcessorExtension} the Extension stored in the registry. * * @param {...*} args - Class constructor, instance, or block function. * @returns {ProcessorExtension} the Extension stored in the registry. */ includeProcessor(fn: (this: IncludeProcessorDslInterface) => void): ProcessorExtension; /** * Return the registered IncludeProcessor extensions, or null if none. * * @returns {ProcessorExtension[]|null} */ includeProcessors(): ProcessorExtension[] | null; /** * Check whether any IncludeProcessor extensions have been registered. * * @returns {boolean} */ hasIncludeProcessors(): boolean; /** Alias for {@link includeProcessor} (snake_case for prefer() / Registry method dispatch). */ include_processor(...args: any[]): ProcessorExtension; /** * Register a DocinfoProcessor with the extension registry. * * @overload * @param {typeof DocinfoProcessor} processor - A DocinfoProcessor subclass. * @returns {ProcessorExtension} the Extension stored in the registry. * * @overload * @param {DocinfoProcessor} processor - An already-constructed DocinfoProcessor instance. * @returns {ProcessorExtension} the Extension stored in the registry. * * @overload * @param {(this: DocinfoProcessorDslInterface) => void} fn - Registration function bound to the docinfo processor DSL. * @returns {ProcessorExtension} the Extension stored in the registry. * * @param {...*} args - Class constructor, instance, or block function. * @returns {ProcessorExtension} the Extension stored in the registry. */ docinfoProcessor(processor: typeof DocinfoProcessor): ProcessorExtension; /** * Register a DocinfoProcessor with the extension registry. * * @overload * @param {typeof DocinfoProcessor} processor - A DocinfoProcessor subclass. * @returns {ProcessorExtension} the Extension stored in the registry. * * @overload * @param {DocinfoProcessor} processor - An already-constructed DocinfoProcessor instance. * @returns {ProcessorExtension} the Extension stored in the registry. * * @overload * @param {(this: DocinfoProcessorDslInterface) => void} fn - Registration function bound to the docinfo processor DSL. * @returns {ProcessorExtension} the Extension stored in the registry. * * @param {...*} args - Class constructor, instance, or block function. * @returns {ProcessorExtension} the Extension stored in the registry. */ docinfoProcessor(processor: DocinfoProcessor): ProcessorExtension; /** * Register a DocinfoProcessor with the extension registry. * * @overload * @param {typeof DocinfoProcessor} processor - A DocinfoProcessor subclass. * @returns {ProcessorExtension} the Extension stored in the registry. * * @overload * @param {DocinfoProcessor} processor - An already-constructed DocinfoProcessor instance. * @returns {ProcessorExtension} the Extension stored in the registry. * * @overload * @param {(this: DocinfoProcessorDslInterface) => void} fn - Registration function bound to the docinfo processor DSL. * @returns {ProcessorExtension} the Extension stored in the registry. * * @param {...*} args - Class constructor, instance, or block function. * @returns {ProcessorExtension} the Extension stored in the registry. */ docinfoProcessor(fn: (this: DocinfoProcessorDslInterface) => void): ProcessorExtension; /** * Check whether any DocinfoProcessor extensions have been registered. * * @param {string|null} [location=null] - Optional location ('head' or 'footer') to filter by. * @returns {boolean} */ hasDocinfoProcessors(location?: string | null): boolean; /** * Retrieve Extension proxy objects for DocinfoProcessor instances. * * @param {string|null} [location=null] - Optional location ('head' or 'footer') to filter by. * @returns {ProcessorExtension[]} array of Extension proxy objects. */ docinfoProcessors(location?: string | null): ProcessorExtension[]; /** Alias for {@link docinfoProcessor} (snake_case for prefer() / Registry method dispatch). */ docinfo_processor(...args: any[]): ProcessorExtension; /** * Register a BlockProcessor with the extension registry. * * @example * // 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) { ... }) * }) * * @overload * @param {typeof BlockProcessor} processor - A BlockProcessor subclass. * @param {string} [name] - Optional explicit block name. * @returns {ProcessorExtension} an Extension proxy object. * * @overload * @param {BlockProcessor} processor - An already-constructed BlockProcessor instance. * @param {string} [name] - Optional explicit block name (overrides the instance's name). * @returns {ProcessorExtension} an Extension proxy object. * * @overload * @param {string} name - The block name. * @param {(this: BlockProcessorDslInterface) => void} fn - Registration function bound to the block DSL. * @returns {ProcessorExtension} an Extension proxy object. * * @overload * @param {(this: BlockProcessorDslInterface) => void} fn - Registration function bound to the block DSL. * @returns {ProcessorExtension} an Extension proxy object. * * @param {...*} args - Class constructor, instance, block function, or name + one of those. * @returns {ProcessorExtension} an Extension proxy object. */ block(processor: typeof BlockProcessor, name?: string): ProcessorExtension; /** * Register a BlockProcessor with the extension registry. * * @example * // 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) { ... }) * }) * * @overload * @param {typeof BlockProcessor} processor - A BlockProcessor subclass. * @param {string} [name] - Optional explicit block name. * @returns {ProcessorExtension} an Extension proxy object. * * @overload * @param {BlockProcessor} processor - An already-constructed BlockProcessor instance. * @param {string} [name] - Optional explicit block name (overrides the instance's name). * @returns {ProcessorExtension} an Extension proxy object. * * @overload * @param {string} name - The block name. * @param {(this: BlockProcessorDslInterface) => void} fn - Registration function bound to the block DSL. * @returns {ProcessorExtension} an Extension proxy object. * * @overload * @param {(this: BlockProcessorDslInterface) => void} fn - Registration function bound to the block DSL. * @returns {ProcessorExtension} an Extension proxy object. * * @param {...*} args - Class constructor, instance, block function, or name + one of those. * @returns {ProcessorExtension} an Extension proxy object. */ block(processor: BlockProcessor, name?: string): ProcessorExtension; /** * Register a BlockProcessor with the extension registry. * * @example * // 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) { ... }) * }) * * @overload * @param {typeof BlockProcessor} processor - A BlockProcessor subclass. * @param {string} [name] - Optional explicit block name. * @returns {ProcessorExtension} an Extension proxy object. * * @overload * @param {BlockProcessor} processor - An already-constructed BlockProcessor instance. * @param {string} [name] - Optional explicit block name (overrides the instance's name). * @returns {ProcessorExtension} an Extension proxy object. * * @overload * @param {string} name - The block name. * @param {(this: BlockProcessorDslInterface) => void} fn - Registration function bound to the block DSL. * @returns {ProcessorExtension} an Extension proxy object. * * @overload * @param {(this: BlockProcessorDslInterface) => void} fn - Registration function bound to the block DSL. * @returns {ProcessorExtension} an Extension proxy object. * * @param {...*} args - Class constructor, instance, block function, or name + one of those. * @returns {ProcessorExtension} an Extension proxy object. */ block(name: string, fn: (this: BlockProcessorDslInterface) => void): ProcessorExtension; /** * Register a BlockProcessor with the extension registry. * * @example * // 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) { ... }) * }) * * @overload * @param {typeof BlockProcessor} processor - A BlockProcessor subclass. * @param {string} [name] - Optional explicit block name. * @returns {ProcessorExtension} an Extension proxy object. * * @overload * @param {BlockProcessor} processor - An already-constructed BlockProcessor instance. * @param {string} [name] - Optional explicit block name (overrides the instance's name). * @returns {ProcessorExtension} an Extension proxy object. * * @overload * @param {string} name - The block name. * @param {(this: BlockProcessorDslInterface) => void} fn - Registration function bound to the block DSL. * @returns {ProcessorExtension} an Extension proxy object. * * @overload * @param {(this: BlockProcessorDslInterface) => void} fn - Registration function bound to the block DSL. * @returns {ProcessorExtension} an Extension proxy object. * * @param {...*} args - Class constructor, instance, block function, or name + one of those. * @returns {ProcessorExtension} an Extension proxy object. */ block(fn: (this: BlockProcessorDslInterface) => void): ProcessorExtension; /** * Check whether any BlockProcessor extensions have been registered. * * @returns {boolean} */ hasBlocks(): boolean; /** * Retrieve all BlockProcessor Extension proxy objects. * * @returns {ProcessorExtension[]} */ blocks(): ProcessorExtension[]; /** * Check whether a BlockProcessor is registered for the given name and context. * * @param {string} name - The block name. * @param {string} context - The block context. * @returns {ProcessorExtension|false} the Extension proxy or false. */ registeredForBlock(name: string, context: string): ProcessorExtension | false; /** * Retrieve the Extension proxy for the BlockProcessor registered with the given name. * * @param {string} name - The block name. * @returns {ProcessorExtension|null} */ findBlockExtension(name: string): ProcessorExtension | null; /** * Register a BlockMacroProcessor with the extension registry. * * @overload * @param {typeof BlockMacroProcessor} processor - A BlockMacroProcessor subclass. * @param {string} [name] - Optional explicit macro name. * @returns {ProcessorExtension} the Extension stored in the registry. * * @overload * @param {BlockMacroProcessor} processor - An already-constructed BlockMacroProcessor instance. * @param {string} [name] - Optional explicit macro name (overrides the instance's name). * @returns {ProcessorExtension} the Extension stored in the registry. * * @overload * @param {string} name - The macro name. * @param {(this: BlockMacroProcessorDslInterface) => void} fn - Registration function bound to the block macro DSL. * @returns {ProcessorExtension} the Extension stored in the registry. * * @overload * @param {(this: BlockMacroProcessorDslInterface) => void} fn - Registration function bound to the block macro DSL. * @returns {ProcessorExtension} the Extension stored in the registry. * * @param {...*} args - Class constructor, instance, or block function. * @returns {ProcessorExtension} the Extension stored in the registry. */ blockMacro(processor: typeof BlockMacroProcessor, name?: string): ProcessorExtension; /** * Register a BlockMacroProcessor with the extension registry. * * @overload * @param {typeof BlockMacroProcessor} processor - A BlockMacroProcessor subclass. * @param {string} [name] - Optional explicit macro name. * @returns {ProcessorExtension} the Extension stored in the registry. * * @overload * @param {BlockMacroProcessor} processor - An already-constructed BlockMacroProcessor instance. * @param {string} [name] - Optional explicit macro name (overrides the instance's name). * @returns {ProcessorExtension} the Extension stored in the registry. * * @overload * @param {string} name - The macro name. * @param {(this: BlockMacroProcessorDslInterface) => void} fn - Registration function bound to the block macro DSL. * @returns {ProcessorExtension} the Extension stored in the registry. * * @overload * @param {(this: BlockMacroProcessorDslInterface) => void} fn - Registration function bound to the block macro DSL. * @returns {ProcessorExtension} the Extension stored in the registry. * * @param {...*} args - Class constructor, instance, or block function. * @returns {ProcessorExtension} the Extension stored in the registry. */ blockMacro(processor: BlockMacroProcessor, name?: string): ProcessorExtension; /** * Register a BlockMacroProcessor with the extension registry. * * @overload * @param {typeof BlockMacroProcessor} processor - A BlockMacroProcessor subclass. * @param {string} [name] - Optional explicit macro name. * @returns {ProcessorExtension} the Extension stored in the registry. * * @overload * @param {BlockMacroProcessor} processor - An already-constructed BlockMacroProcessor instance. * @param {string} [name] - Optional explicit macro name (overrides the instance's name). * @returns {ProcessorExtension} the Extension stored in the registry. * * @overload * @param {string} name - The macro name. * @param {(this: BlockMacroProcessorDslInterface) => void} fn - Registration function bound to the block macro DSL. * @returns {ProcessorExtension} the Extension stored in the registry. * * @overload * @param {(this: BlockMacroProcessorDslInterface) => void} fn - Registration function bound to the block macro DSL. * @returns {ProcessorExtension} the Extension stored in the registry. * * @param {...*} args - Class constructor, instance, or block function. * @returns {ProcessorExtension} the Extension stored in the registry. */ blockMacro(name: string, fn: (this: BlockMacroProcessorDslInterface) => void): ProcessorExtension; /** * Register a BlockMacroProcessor with the extension registry. * * @overload * @param {typeof BlockMacroProcessor} processor - A BlockMacroProcessor subclass. * @param {string} [name] - Optional explicit macro name. * @returns {ProcessorExtension} the Extension stored in the registry. * * @overload * @param {BlockMacroProcessor} processor - An already-constructed BlockMacroProcessor instance. * @param {string} [name] - Optional explicit macro name (overrides the instance's name). * @returns {ProcessorExtension} the Extension stored in the registry. * * @overload * @param {string} name - The macro name. * @param {(this: BlockMacroProcessorDslInterface) => void} fn - Registration function bound to the block macro DSL. * @returns {ProcessorExtension} the Extension stored in the registry. * * @overload * @param {(this: BlockMacroProcessorDslInterface) => void} fn - Registration function bound to the block macro DSL. * @returns {ProcessorExtension} the Extension stored in the registry. * * @param {...*} args - Class constructor, instance, or block function. * @returns {ProcessorExtension} the Extension stored in the registry. */ blockMacro(fn: (this: BlockMacroProcessorDslInterface) => void): ProcessorExtension; /** @deprecated Alias for {@link blockMacro}. */ block_macro(...args: any[]): ProcessorExtension; /** * Check whether any BlockMacroProcessor extensions have been registered. * * @returns {boolean} */ hasBlockMacros(): boolean; /** * Retrieve all BlockMacroProcessor Extension proxy objects. * * @returns {ProcessorExtension[]} */ blockMacros(): ProcessorExtension[]; /** * Check whether a BlockMacroProcessor is registered for the given name. * * @param {string} name - The macro name. * @returns {ProcessorExtension|false} */ registeredForBlockMacro(name: string): ProcessorExtension | false; /** * Retrieve the Extension proxy for the BlockMacroProcessor registered with the given name. * * @param {string} name - The macro name. * @returns {ProcessorExtension|null} */ findBlockMacroExtension(name: string): ProcessorExtension | null; /** * Register an InlineMacroProcessor with the extension registry. * * @overload * @param {typeof InlineMacroProcessor} processor - An InlineMacroProcessor subclass. * @param {string} [name] - Optional explicit macro name. * @returns {ProcessorExtension} the Extension stored in the registry. * * @overload * @param {InlineMacroProcessor} processor - An already-constructed InlineMacroProcessor instance. * @param {string} [name] - Optional explicit macro name (overrides the instance's name). * @returns {ProcessorExtension} the Extension stored in the registry. * * @overload * @param {string} name - The macro name. * @param {(this: InlineMacroProcessorDslInterface) => void} fn - Registration function bound to the inline macro DSL. * @returns {ProcessorExtension} the Extension stored in the registry. * * @overload * @param {(this: InlineMacroProcessorDslInterface) => void} fn - Registration function bound to the inline macro DSL. * @returns {ProcessorExtension} the Extension stored in the registry. * * @param {...*} args - Class constructor, instance, or block function. * @returns {ProcessorExtension} the Extension stored in the registry. */ inlineMacro(processor: typeof InlineMacroProcessor, name?: string): ProcessorExtension; /** * Register an InlineMacroProcessor with the extension registry. * * @overload * @param {typeof InlineMacroProcessor} processor - An InlineMacroProcessor subclass. * @param {string} [name] - Optional explicit macro name. * @returns {ProcessorExtension} the Extension stored in the registry. * * @overload * @param {InlineMacroProcessor} processor - An already-constructed InlineMacroProcessor instance. * @param {string} [name] - Optional explicit macro name (overrides the instance's name). * @returns {ProcessorExtension} the Extension stored in the registry. * * @overload * @param {string} name - The macro name. * @param {(this: InlineMacroProcessorDslInterface) => void} fn - Registration function bound to the inline macro DSL. * @returns {ProcessorExtension} the Extension stored in the registry. * * @overload * @param {(this: InlineMacroProcessorDslInterface) => void} fn - Registration function bound to the inline macro DSL. * @returns {ProcessorExtension} the Extension stored in the registry. * * @param {...*} args - Class constructor, instance, or block function. * @returns {ProcessorExtension} the Extension stored in the registry. */ inlineMacro(processor: InlineMacroProcessor, name?: string): ProcessorExtension; /** * Register an InlineMacroProcessor with the extension registry. * * @overload * @param {typeof InlineMacroProcessor} processor - An InlineMacroProcessor subclass. * @param {string} [name] - Optional explicit macro name. * @returns {ProcessorExtension} the Extension stored in the registry. * * @overload * @param {InlineMacroProcessor} processor - An already-constructed InlineMacroProcessor instance. * @param {string} [name] - Optional explicit macro name (overrides the instance's name). * @returns {ProcessorExtension} the Extension stored in the registry. * * @overload * @param {string} name - The macro name. * @param {(this: InlineMacroProcessorDslInterface) => void} fn - Registration function bound to the inline macro DSL. * @returns {ProcessorExtension} the Extension stored in the registry. * * @overload * @param {(this: InlineMacroProcessorDslInterface) => void} fn - Registration function bound to the inline macro DSL. * @returns {ProcessorExtension} the Extension stored in the registry. * * @param {...*} args - Class constructor, instance, or block function. * @returns {ProcessorExtension} the Extension stored in the registry. */ inlineMacro(name: string, fn: (this: InlineMacroProcessorDslInterface) => void): ProcessorExtension; /** * Register an InlineMacroProcessor with the extension registry. * * @overload * @param {typeof InlineMacroProcessor} processor - An InlineMacroProcessor subclass. * @param {string} [name] - Optional explicit macro name. * @returns {ProcessorExtension} the Extension stored in the registry. * * @overload * @param {InlineMacroProcessor} processor - An already-constructed InlineMacroProcessor instance. * @param {string} [name] - Optional explicit macro name (overrides the instance's name). * @returns {ProcessorExtension} the Extension stored in the registry. * * @overload * @param {string} name - The macro name. * @param {(this: InlineMacroProcessorDslInterface) => void} fn - Registration function bound to the inline macro DSL. * @returns {ProcessorExtension} the Extension stored in the registry. * * @overload * @param {(this: InlineMacroProcessorDslInterface) => void} fn - Registration function bound to the inline macro DSL. * @returns {ProcessorExtension} the Extension stored in the registry. * * @param {...*} args - Class constructor, instance, or block function. * @returns {ProcessorExtension} the Extension stored in the registry. */ inlineMacro(fn: (this: InlineMacroProcessorDslInterface) => void): ProcessorExtension; /** @deprecated Alias for {@link inlineMacro}. */ inline_macro(...args: any[]): ProcessorExtension; /** * Check whether any InlineMacroProcessor extensions have been registered. * * @returns {boolean} */ hasInlineMacros(): boolean; /** * Check whether an InlineMacroProcessor is registered for the given name. * * @param {string} name - The macro name. * @returns {ProcessorExtension|false} */ registeredForInlineMacro(name: string): ProcessorExtension | false; /** * Retrieve the Extension proxy for the InlineMacroProcessor registered with the given name. * * @param {string} name - The macro name. * @returns {ProcessorExtension|null} */ findInlineMacroExtension(name: string): ProcessorExtension | null; /** * Retrieve all InlineMacroProcessor Extension proxy objects. * * @returns {ProcessorExtension[]} */ inlineMacros(): ProcessorExtension[]; /** * Insert the document-processor Extension as the first of its kind in the extension registry. * * @example * registry.prefer('includeProcessor', function () { * this.process(function (document, reader, target, attrs) { ... }) * }) * * @param {...*} args - A ProcessorExtension, or a method name followed by processor args. * @returns {ProcessorExtension} the Extension stored in the registry. */ prefer(...args: any[]): ProcessorExtension; /** @returns {object} the plain Object that maps names to groups for this registry. */ getGroups(): object; /** Alias for {@link preprocessors}. */ getPreprocessors(): ProcessorExtension[]; /** Alias for {@link treeProcessors}. */ getTreeProcessors(): ProcessorExtension[]; /** Alias for {@link includeProcessors}. */ getIncludeProcessors(): ProcessorExtension[]; /** Alias for {@link postprocessors}. */ getPostprocessors(): ProcessorExtension[]; /** * Alias for {@link docinfoProcessors}. * * @param {string|null} [location=null] */ getDocinfoProcessors(location?: string | null): ProcessorExtension[]; /** Alias for {@link blocks}. */ getBlocks(): ProcessorExtension[]; /** Alias for {@link blockMacros}. */ getBlockMacros(): ProcessorExtension[]; /** Alias for {@link inlineMacros}. */ getInlineMacros(): ProcessorExtension[]; /** * Alias for {@link registeredForInlineMacro}. * * @param {string} name */ getInlineMacroFor(name: string): false | ProcessorExtension; /** * Alias for {@link registeredForBlock}. * * @param {string} name * @param {string} context */ getBlockFor(name: string, context: string): false | ProcessorExtension; /** * Alias for {@link registeredForBlockMacro}. * * @param {string} name */ getBlockMacroFor(name: string): false | ProcessorExtension; } export namespace Extensions { /** * Return the plain Object that maps names to registered groups. * * @returns {object} */ function groups(): object; /** * Alias for {@link groups}. * * @returns {object} */ function getGroups(): object; /** * Create a new Registry, optionally pre-populated with a named block. * * When a `block` is provided it is stored as a group and re-executed on every * activation, making the registry safe to reuse across multiple conversions. * Without a `block`, any extensions registered directly on the returned registry * (e.g. `registry.preprocessor(fn)`) are stored in transient state that is * cleared on every activation — those registrations will be lost from the second * conversion onwards. Prefer the block form when the registry may be reused. * * @param {string|null} [name=null] - Optional name for the group; auto-generated if omitted. * @param {Function|null} [block=null] - Optional function to register as the group. * @returns {Registry} */ function create(name?: string | null, block?: Function | null): Registry; /** * Register an extension Group that subsequently registers extensions. * * @example * Extensions.register(UmlExtensions) * Extensions.register('uml', UmlExtensions) * Extensions.register(function () { this.blockMacro('plantuml', PlantUmlBlock) }) * Extensions.register('uml', function () { this.blockMacro('plantuml', PlantUmlBlock) }) * * @param {...*} args - Optional name followed by a Group class, instance, or function. * @returns {Function|object} the registered group. */ function register(...args: any[]): Function | object; /** * Unregister all statically-registered extension groups. */ function unregisterAll(): void; /** * Unregister statically-registered extension groups by name. * * @param {...string} names - One or more group names to unregister. */ function unregister(...names: string[]): void; /** * Create a Preprocessor subclass with the given prototype functions. * * @param {string} [name] - Optional class name. * @param {object} [functions] - Methods to mix into the prototype. * @returns {typeof Preprocessor} */ function createPreprocessor(name?: string, functions?: object, ...args: any[]): typeof Preprocessor; /** * Create and return a new Preprocessor instance with the given prototype functions. * * @param {string} [name] - Optional class name. * @param {object} [functions] - Methods to mix into the prototype. * @returns {Preprocessor} */ function newPreprocessor(name?: string, functions?: object, ...args: any[]): Preprocessor; /** * Create a TreeProcessor subclass with the given prototype functions. * * @param {string} [name] - Optional class name. * @param {object} [functions] - Methods to mix into the prototype. * @returns {typeof TreeProcessor} */ function createTreeProcessor(name?: string, functions?: object, ...args: any[]): typeof TreeProcessor; /** * Create and return a new TreeProcessor instance with the given prototype functions. * * @param {string} [name] - Optional class name. * @param {object} [functions] - Methods to mix into the prototype. * @returns {TreeProcessor} */ function newTreeProcessor(name?: string, functions?: object, ...args: any[]): TreeProcessor; /** * Create a Postprocessor subclass with the given prototype functions. * * @param {string} [name] - Optional class name. * @param {object} [functions] - Methods to mix into the prototype. * @returns {typeof Postprocessor} */ function createPostprocessor(name?: string, functions?: object, ...args: any[]): typeof Postprocessor; /** * Create and return a new Postprocessor instance with the given prototype functions. * * @param {string} [name] - Optional class name. * @param {object} [functions] - Methods to mix into the prototype. * @returns {Postprocessor} */ function newPostprocessor(name?: string, functions?: object, ...args: any[]): Postprocessor; /** * Create an IncludeProcessor subclass with the given prototype functions. * * @param {string} [name] - Optional class name. * @param {object} [functions] - Methods to mix into the prototype. * @returns {typeof IncludeProcessor} */ function createIncludeProcessor(name?: string, functions?: object, ...args: any[]): typeof IncludeProcessor; /** * Create and return a new IncludeProcessor instance with the given prototype functions. * * @param {string} [name] - Optional class name. * @param {object} [functions] - Methods to mix into the prototype. * @returns {IncludeProcessor} */ function newIncludeProcessor(name?: string, functions?: object, ...args: any[]): IncludeProcessor; /** * Create a DocinfoProcessor subclass with the given prototype functions. * * @param {string} [name] - Optional class name. * @param {object} [functions] - Methods to mix into the prototype. * @returns {typeof DocinfoProcessor} */ function createDocinfoProcessor(name?: string, functions?: object, ...args: any[]): typeof DocinfoProcessor; /** * Create and return a new DocinfoProcessor instance with the given prototype functions. * * @param {string} [name] - Optional class name. * @param {object} [functions] - Methods to mix into the prototype. * @returns {DocinfoProcessor} */ function newDocinfoProcessor(name?: string, functions?: object, ...args: any[]): DocinfoProcessor; /** * Create a BlockProcessor subclass with the given prototype functions. * * @param {string} [name] - Optional class name. * @param {object} [functions] - Methods to mix into the prototype. * @returns {typeof BlockProcessor} */ function createBlockProcessor(name?: string, functions?: object, ...args: any[]): typeof BlockProcessor; /** * Create and return a new BlockProcessor instance with the given prototype functions. * * @param {string} [name] - Optional class name. * @param {object} [functions] - Methods to mix into the prototype. * @returns {BlockProcessor} */ function newBlockProcessor(name?: string, functions?: object, ...args: any[]): BlockProcessor; /** * Create an InlineMacroProcessor subclass with the given prototype functions. * * @param {string} [name] - Optional class name. * @param {object} [functions] - Methods to mix into the prototype. * @returns {typeof InlineMacroProcessor} */ function createInlineMacroProcessor(name?: string, functions?: object, ...args: any[]): typeof InlineMacroProcessor; /** * Create and return a new InlineMacroProcessor instance with the given prototype functions. * * @param {string} [name] - Optional class name. * @param {object} [functions] - Methods to mix into the prototype. * @returns {InlineMacroProcessor} */ function newInlineMacroProcessor(name?: string, functions?: object, ...args: any[]): InlineMacroProcessor; /** * Create a BlockMacroProcessor subclass with the given prototype functions. * * @param {string} [name] - Optional class name. * @param {object} [functions] - Methods to mix into the prototype. * @returns {typeof BlockMacroProcessor} */ function createBlockMacroProcessor(name?: string, functions?: object, ...args: any[]): typeof BlockMacroProcessor; /** * Create and return a new BlockMacroProcessor instance with the given prototype functions. * * @param {string} [name] - Optional class name. * @param {object} [functions] - Methods to mix into the prototype. * @returns {BlockMacroProcessor} */ function newBlockMacroProcessor(name?: string, functions?: object, ...args: any[]): BlockMacroProcessor; } export type Document = import("./document.js").Document; export type AbstractBlock = import("./abstract_block.js").AbstractBlock; export type PreprocessorReader = import("./reader.js").PreprocessorReader; /** * DSL interface for configuring a {@link Processor} instance. * Applied to a processor instance via `Object.assign(instance, DslMixin)`. * * The `process` property behaves as a setter when called with a single Function * argument (stores the process block), or as a passthrough caller otherwise. */ export type ProcessorDslInterface = { /** * - Set a config option. */ option: (key: string, value: unknown) => void; /** * - Register the process function. */ process: (fn: (...args: unknown[]) => unknown) => void; /** * - Returns true if a process function has been registered. */ processBlockGiven: () => boolean; }; /** * DSL interface for document processors (Preprocessor, TreeProcessor, Postprocessor, DocinfoProcessor). */ export type DocumentProcessorDslInterface = ProcessorDslInterface & { prefer(): void; prepend(): void; }; /** * DSL interface for preprocessors. */ export type PreprocessorDslInterface = Omit & { process(fn: (this: PreprocessorDslInterface, document: Document, reader: PreprocessorReader) => Reader | void): void; }; /** * DSL interface for tree processors. */ export type TreeProcessorDslInterface = Omit & { process(fn: (this: TreeProcessorDslInterface, document: Document) => Document | void): void; }; /** * DSL interface for postprocessors. */ export type PostprocessorDslInterface = Omit & { process(fn: (this: PostprocessorDslInterface, document: Document, output: string) => string): void; }; /** * DSL interface for syntax processors (BlockProcessor, BlockMacroProcessor, InlineMacroProcessor). */ export type SyntaxProcessorDslInterface = ProcessorDslInterface & { named(value: string): void; contentModel(value: string): void; parseContentAs(value: string): void; positionalAttributes(...value: string[]): void; namePositionalAttributes(...value: string[]): void; positionalAttrs(...value: string[]): void; defaultAttributes(value: Record): void; defaultAttrs(value: Record): void; resolveAttributes(...args: unknown[]): void; resolvesAttributes(...args: unknown[]): void; }; /** * DSL interface for include processors. */ export type IncludeProcessorDslInterface = Omit & { handles(fn: (target: string) => boolean): void; handles(fn: (doc: Document, target: string) => boolean): void; process(fn: (this: IncludeProcessorDslInterface, document: Document, reader: PreprocessorReader, target: string, attributes: Record) => void): void; }; /** * DSL interface for docinfo processors. */ export type DocinfoProcessorDslInterface = Omit & { atLocation(value: string): void; process(fn: (this: DocinfoProcessorDslInterface, document: Document) => string): void; }; /** * DSL interface for block processors. * * The `process` callback is bound to the processor instance, so `this` inside it * (and inside the registration function) exposes the `createBlock` helpers. */ export type BlockProcessorDslInterface = Omit & { contexts(...value: (string | string[])[]): void; onContexts(...value: (string | string[])[]): void; onContext(...value: (string | string[])[]): void; bindTo(...value: (string | string[])[]): void; createBlock(parent: AbstractBlock, context: string, source?: string | string[] | null, attrs?: object, opts?: object): Block; process(fn: (this: BlockProcessorDslInterface, parent: AbstractBlock, reader: Reader, attributes: Record) => AbstractBlock | void): void; }; /** * DSL interface for macro processors (block and inline macros). */ export type MacroProcessorDslInterface = SyntaxProcessorDslInterface; /** * DSL interface for block macro processors. * * The `process` callback is bound to the processor instance, so `this` inside it * (and inside the registration function) exposes the `createBlock` helpers. */ export type BlockMacroProcessorDslInterface = Omit & { createBlock(parent: AbstractBlock, context: string, source?: string | string[] | null, attrs?: object, opts?: object): Block; process(fn: (this: BlockMacroProcessorDslInterface, parent: AbstractBlock, target: string, attributes: Record) => AbstractBlock | void): void; }; /** * DSL interface for inline macro processors. * * The `process` callback is bound to the processor instance, so `this` inside it * (and inside the registration function) exposes the `createInline` helper. */ export type InlineMacroProcessorDslInterface = Omit & { format(value: string): void; matchFormat(value: string): void; usingFormat(value: string): void; match(value: RegExp): void; createInline(parent: AbstractBlock, context: string, text: string, opts?: object): Inline; process(fn: (this: InlineMacroProcessorDslInterface, parent: AbstractBlock, target: string, attributes: Record) => Inline | void): void; }; import { Section } from './section.js'; import { Block } from './block.js'; import { List } from './list.js'; import { ListItem } from './list.js'; import { Inline } from './inline.js'; import { Reader } from './reader.js';