myst-to-html
Version:
Export from MyST mdast to HTML
44 lines • 1.64 kB
TypeScript
import type { Plugin } from 'unified';
import type { Handle } from 'hast-util-to-mdast';
import { AdmonitionKind } from 'myst-common';
import type { GenericNode, GenericParent } from 'myst-common';
import type { EnumeratorOptions, State } from './state.js';
export type Admonition = GenericNode<{
kind?: AdmonitionKind;
class?: string;
}>;
export type TransformOptions = {
addAdmonitionHeaders?: boolean;
addContainerCaptionNumbers?: boolean;
} & EnumeratorOptions;
export type HtmlToMdastOptions = {
htmlHandlers?: {
[x: string]: Handle;
};
keepBreaks?: boolean;
};
export declare function addAdmonitionHeaders(tree: GenericParent): void;
export declare function addContainerCaptionNumbers(tree: GenericParent, state: State): 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: GenericParent): void;
/**
* Ensure caption content is nested in a paragraph.
*
* This function is idempotent!
*/
export declare function ensureCaptionIsParagraph(tree: GenericParent): void;
export declare function convertHtmlToMdast(tree: GenericParent, opts?: HtmlToMdastOptions): GenericParent;
export declare const transform: Plugin<[State, TransformOptions?], string, GenericParent>;
//# sourceMappingURL=transforms.d.ts.map