mystjs
Version:
Markdown parser for MyST markdown in JavaScript
41 lines (40 loc) • 1.5 kB
TypeScript
import type { Root } from 'mdast';
import type { Plugin } from 'unified';
import type { Handle } from 'hast-util-to-mdast';
import type { EnumeratorOptions, State } from './state';
export declare type TransformOptions = {
addAdmonitionHeaders?: boolean;
addContainerCaptionNumbers?: boolean;
} & EnumeratorOptions;
export declare type HtmlToMdastOptions = {
htmlHandlers?: {
[x: string]: Handle;
};
keepBreaks?: boolean;
};
export declare function addAdmonitionHeaders(tree: Root): void;
export declare function addContainerCaptionNumbers(tree: Root, state: State): void;
/** @deprecated use myst-common */
export declare function liftChildren(tree: Root, nodeType: string): void;
/**
* Propagate target identifier/value to subsequent node
*
* Note: While this propagation happens regardless of the
* subsequent node type, references are only resolved to
* the TargetKind nodes enumerated in state.ts. For example:
*
* (paragraph-target)=
* Just a normal paragraph
*
* will add identifier/label to paragraph node, but the node
* will still not be targetable.
*/
export declare function propagateTargets(tree: Root): void;
/**
* Ensure caption content is nested in a paragraph.
*
* This function is idempotent!
*/
export declare function ensureCaptionIsParagraph(tree: Root): void;
export declare function convertHtmlToMdast(tree: Root, opts?: HtmlToMdastOptions): Root;
export declare const transform: Plugin<[State, TransformOptions?], string, Root>;