UNPKG

@knodes/typedoc-pluginutils

Version:
50 lines 2.14 kB
import { JSX, MarkdownEvent } from 'typedoc'; import { ABasePlugin, IPluginComponent, PluginAccessor } from '../../base-plugin'; import { Tag } from '../types'; export declare class MarkdownReplacer implements IPluginComponent { private static readonly _mapContainers; readonly plugin: ABasePlugin; private readonly _logger; private readonly _currentPageMemo; /** * Get the list of source map containers for the given event. * * @param event - The event to get source maps for. * @returns the source map list. */ private static _getEventMapContainer; constructor(pluginAccessor: PluginAccessor); /** * Register an inline tag (eg. `{@tag ....}`) to replace in markdown with optional params regex and execute a callback to replace it. * * @param tagName - The name of the tag to match. * @param paramsRegExp - An optional regex to capture params. * @param callback - The callback to execute to replace the match. * @param options - Extra options. */ registerMarkdownTag(tagName: Tag, paramsRegExp: RegExp | null, callback: MarkdownReplacer.ReplaceCallback, options?: MarkdownReplacer.IRegisterOptions): void; /** * Match every strings for {@link regex} & replace them with the return value of the {@link callback}. This method mutates the {@link event}. * * @param regex - The regex to match. * @param callback - The callback to execute with fullMatch, captures, & a source hint. * @param label - The replacer name. * @param excludeMatches - A list of matches to skip. * @param event - The event to modify. */ private _processMarkdown; } export declare namespace MarkdownReplacer { type SourceHint = () => string; interface Match { fullMatch: string; captures: Array<string | null>; event: MarkdownEvent; } type ReplaceCallback = (match: Match, sourceHint: SourceHint) => string | JSX.Element | undefined; interface IRegisterOptions { excludedMatches?: string[]; priority?: number; } } //# sourceMappingURL=markdown-replacer.d.ts.map