/* auto-generated by NAPI-RS */ /* eslint-disable */ /** * Apply MDAST commands and convert to HAST handle in one step. * The MDAST handle is consumed (emptied). */ export declare function applyCommandsAndConvertToHastHandle(handle: MdastHandle, commandBuf: Uint8Array, convertOptions?: JsConvertOptions | undefined | null): HastHandle /** * Apply a command buffer to a HAST handle's arena in-place. Returns how many * patches were dropped because their target lived inside a subtree this pass * removed or replaced (see the lenient note below); the JS pipeline warns when * non-zero. Mirrors `apply_commands_to_mdast_handle`. */ export declare function applyCommandsToHandle(handle: HastHandle, commandBuf: Uint8Array): number /** * Apply a command buffer to an MDAST handle in-place. Returns how many patches * were dropped because their target lived inside a subtree this pass removed or * replaced (see the lenient note below); the JS pipeline warns when non-zero. */ export declare function applyCommandsToMdastHandle(handle: MdastHandle, commandBuf: Uint8Array): number /** Compile a HAST handle's arena to MDX JavaScript. Does not consume the handle. */ export declare function compileHandle(handle: HastHandle, options?: JsMdxOptions | undefined | null): string /** Compile MDX source directly to JavaScript. */ export declare function compileMdx(source: string, options?: JsMdxOptions | undefined | null, features?: JsFeatures | undefined | null, convertOptions?: JsConvertOptions | undefined | null): string /** Convert an MDAST handle to a HAST handle. The MDAST handle is consumed (emptied). */ export declare function convertMdastToHastHandle(handle: MdastHandle, convertOptions?: JsConvertOptions | undefined | null): HastHandle /** * Parse markdown source and convert to HAST. Returns an opaque handle. * The arena stays in Rust memory, no buffer is copied to JS. */ export declare function createHastHandle(source: string, features?: JsFeatures | undefined | null, convertOptions?: JsConvertOptions | undefined | null): HastHandle /** Parse markdown source into an MDAST arena handle. */ export declare function createMdastHandle(source: string, features?: JsFeatures | undefined | null): MdastHandle /** Parse MDX source and convert to HAST. Returns an opaque handle. */ export declare function createMdxHastHandle(source: string, features?: JsFeatures | undefined | null, convertOptions?: JsConvertOptions | undefined | null): HastHandle /** Parse MDX source into an MDAST arena handle. */ export declare function createMdxMdastHandle(source: string, features?: JsFeatures | undefined | null): MdastHandle /** * Release a handle's arena memory. The handle becomes empty but remains * valid (subsequent calls are no-ops or return empty results). */ export declare function dropHandle(handle: AnyHandle): void /** * Get the source string from a handle. Kind-agnostic: source is the * original markdown/MDX input and is identical across MDAST and HAST. */ export declare function getHandleSource(handle: AnyHandle): string /** * Return the first YAML or TOML frontmatter block in the MDAST arena, if any. * Walks the root node's direct children and returns the first yaml/toml literal. */ export declare function getMdastFrontmatter(handle: MdastHandle): JsFrontmatter | null /** * Read the node_data JSON blob for a node. Returns null if none is set. * Works for both MDAST and HAST handles. */ export declare function getNodeData(handle: AnyHandle, nodeId: number): string | null /** * MDAST→HAST conversion options passed from JavaScript. * * Input-only: `object_to_js = false` because `FunctionRef` only crosses * JS → Rust. A `JsConvertOptions` never gets serialized back to JS. */ export interface JsConvertOptions { /** `

` label opening the footnotes section. Default: `"Footnotes"`. */ footnoteLabel?: string /** Backref `` content. Default: `"\u{21a9}"` (↩). */ footnoteBackContent?: string | ((arg0: number, arg1: number) => string) /** * Backref `aria-label`. The token `{reference}` is replaced with the * footnote number (`1`) or `number-K` (`1-2`) for repeated references. * Default: `"Back to reference {reference}"`. */ footnoteBackLabel?: string | ((arg0: number, arg1: number) => string) } /** Feature toggles for the Markdown/MDX parser, passed from JavaScript. */ export interface JsFeatures { /** GFM: tables, footnotes, strikethrough, task lists. Default: true. */ gfm?: boolean /** Granular GFM control (overrides `gfm`). */ gfmOptions?: JsGfmOptions /** Frontmatter: YAML (`--- ... ---`) and TOML (`+++ ... +++`). Default: true. */ frontmatter?: boolean /** Math blocks and inline math (`$$ ... $$`, `$ ... $`). Default: false. */ math?: boolean /** Granular math control (overrides `math`). */ mathOptions?: JsMathOptions /** Heading attributes (`# text { #id .class }`). Default: false. */ headingAttributes?: boolean /** Colon-delimited container directive blocks (`:::`). Default: false. */ directive?: boolean /** Superscript (`^super^`). Default: false. */ superscript?: boolean /** Subscript (`~sub~`). Default: false. */ subscript?: boolean /** Obsidian-style wikilinks (`[[link]]`). Default: false. */ wikilinks?: boolean /** Smart punctuation: all categories on. Default: false. */ smartPunctuation?: boolean /** Granular smart-punctuation control (overrides `smart_punctuation`). */ smartPunctuationOptions?: JsSmartPunctuationOptions } /** Frontmatter extracted from an MDAST arena. */ export interface JsFrontmatter { /** Either `"yaml"` or `"toml"`. */ kind: string /** Raw frontmatter content between the delimiters (no `---`/`+++` lines). */ value: string } /** * Granular GFM toggles, nested under `features.gfm`. The footnote i18n * strings (label, back-content, back-label) travel separately via the * `JsConvertOptions` argument on conversion entry points; the JS package * extracts them from `features.gfm.footnotes` before calling in. */ export interface JsGfmOptions { /** * Enable GFM footnotes (`[^id]`). Default: true. Set `false` to drop * footnote parsing while keeping the rest of the GFM bundle. */ footnotes?: boolean } /** Granular math toggles, nested under `features.math`. */ export interface JsMathOptions { /** * Treat single-dollar runs (`$ ... $`) as inline math. Default: true. * Set `false` to keep single `$` as literal text (prose with currency) * while still parsing double-dollar (`$$ ... $$`) display math. */ singleDollarTextMath?: boolean } /** MDX compile options passed from JavaScript. */ export interface JsMdxOptions { /** * Static subtree optimization. If provided, static subtrees are collapsed * into raw HTML strings using the specified component and prop. */ optimizeStatic?: JsOptimizeStaticConfig /** * Place to import automatic JSX runtimes from (e.g. "react", "preact"). * Default: "react". */ jsxImportSource?: string /** Whether to keep JSX instead of compiling it away. Default: false. */ jsx?: boolean /** JSX runtime: "automatic" (default) or "classic". */ jsxRuntime?: string /** * Whether to add extra info to error messages and use the development * JSX runtime. Default: false. */ development?: boolean /** Place to import a provider from (e.g. "@mdx-js/react"). */ providerImportSource?: string /** Pragma for JSX in classic runtime (default: "React.createElement"). */ pragma?: string /** Pragma for JSX fragments in classic runtime (default: "React.Fragment"). */ pragmaFrag?: string /** Where to import the pragma from in classic runtime (default: "react"). */ pragmaImportSource?: string /** Output format: "program" (default) or "function-body". */ outputFormat?: string /** * Casing for HTML/SVG attribute names on plain (rehype-produced) * elements. "react" (default) emits `className`, `htmlFor`, etc.; * "html" emits `class`, `for`, `stroke-linecap`, etc. */ elementAttributeNameCase?: string /** * Casing for keys in `style` objects parsed from `style="…"` strings. * "dom" (default) emits `{backgroundColor: …}`; "css" emits * `{"background-color": …}`. */ stylePropertyNameCase?: string } /** Static optimization config passed from JavaScript. */ export interface JsOptimizeStaticConfig { /** Component/element name to wrap collapsed HTML in (e.g. "Fragment", "div"). */ component: string /** Prop name for the HTML string (e.g. "set:html", "dangerouslySetInnerHTML"). */ prop: string /** If true, prop value is wrapped as `{ __html: "..." }` (React-style). */ wrapPropValue?: boolean /** Element tag names to exclude from collapsing. */ ignoreElements?: Array } /** Granular smart-punctuation toggles. */ export interface JsSmartPunctuationOptions { /** Replace straight quotes with curly/smart quotes. Default: true. */ quotes?: boolean /** Replace `--`/`---` with en-dash/em-dash. Default: true. */ dashes?: boolean /** Replace `...` with ellipsis (`…`). Default: true. */ ellipses?: boolean } /** A subscription passed from JS. */ export interface JsSubscription { nodeType: number tagFilter: Array } /** Options for `mdast_text_content_handle`, matching `mdast-util-to-string`. */ export interface JsTextContentOptions { /** Include `alt` text from image nodes. Default: true. */ includeImageAlt?: boolean /** Include `value` from HTML nodes. Default: true. */ includeHtml?: boolean } /** * Collect the concatenated text content of an MDAST node and all its descendants. * Mirrors `mdast-util-to-string`: collects value from text nodes, alt from images. */ export declare function mdastTextContentHandle(handle: MdastHandle, nodeId: number, options?: JsTextContentOptions | undefined | null): string /** Parse ESM (import/export statements) and return ESTree-compatible AST as JSON. */ export declare function parseEsm(source: string): string | null /** * Parse a JavaScript expression and return its ESTree-compatible AST as a JSON string. * Returns null if parsing fails. The JS layer calls JSON.parse (faster than serde_json → NAPI). */ export declare function parseExpression(source: string): string | null /** Parse Markdown source and return HTML string directly. */ export declare function parseToHtml(source: string, features?: JsFeatures | undefined | null, convertOptions?: JsConvertOptions | undefined | null): string /** Render a HAST handle's arena to HTML. Does not consume the handle. */ export declare function renderHandle(handle: HastHandle): string /** * Serialize a handle's arena to the wire-format buffer JS instantiates a * reader from. The kind tag in the header tells the JS side whether to * pick `MdastReader` or `HastReader`. */ export declare function serializeHandle(handle: AnyHandle): Uint8Array /** * Set the `data` blob (JSON bytes) for a node. Works for both MDAST and * HAST handles — `node_data` is a per-node JSON blob with no kind-specific * shape on the Rust side. */ export declare function setNodeData(handle: AnyHandle, nodeId: number, json: Uint8Array): void /** * Collect the concatenated text content of a HAST node and all its descendants. * Walks entirely in Rust, no per-child NAPI round-trips. */ export declare function textContentHandle(handle: HastHandle, nodeId: number): string /** Walk a HAST handle's arena and return matched nodes as a flat binary buffer. */ export declare function walkHandle(handle: HastHandle, subscriptions: Array): Uint8Array /** Walk an MDAST handle's arena and return matched nodes as a flat binary buffer. */ export declare function walkMdastHandle(handle: MdastHandle, subscriptions: Array): Uint8Array