hast-util-to-xast
Version:
hast utility to transform to xast
48 lines • 1.24 kB
TypeScript
/**
* Turn a hast tree into a xast tree.
*
* @param {HastNodes} tree
* hast tree to transform.
* @param {Options | null | undefined} [options]
* Configuration (optional).
* @returns {XastNodes}
* xast tree.
*/
export function toXast(tree: HastNodes, options?: Options | null | undefined): XastNodes;
/**
* Configuration.
*/
export type Options = {
/**
* Which space the document is in (default: `'html'`).
*
* When an `<svg>` element is found in the HTML space, this package already
* automatically switches to and from the SVG space when entering and exiting
* it.
*
* You can also switch explicitly with `xmlns` properties in hast, but note
* that only HTML and SVG are supported.
*/
space?: Space | null | undefined;
};
/**
* Namespace.
*/
export type Space = "html" | "svg";
/**
* Info passed around about the current state.
*/
export type State = {
/**
* Namespace.
*/
ns: string | undefined;
/**
* Current schema.
*/
schema: Schema;
};
import type { Nodes as HastNodes } from 'hast';
import type { Nodes as XastNodes } from 'xast';
import type { Schema } from 'property-information';
//# sourceMappingURL=index.d.ts.map