// This file is auto-generated by alef — DO NOT EDIT.
// alef:hash:c21cae923b0eec07bb0e148f01c0159ff39eded3f9e0a7d0ad5c1c5ef3acf53c
// To regenerate: alef generate
// To verify freshness: alef verify
/* eslint-disable */
export type JsonValue = string | number | boolean | null | JsonValue[] | { [key: string]: JsonValue };
/**
* Convert HTML to Markdown, Djot, or plain text.
*
* Returns a `ConversionResult` with converted content plus optional metadata,
* document structure, table data, inline images, and warnings depending on the
* enabled features and conversion options.
* @param html - — the HTML string to convert.
*
* @param options - — conversion options. Rust accepts bare `ConversionOptions`, `Some(options)`, or `None`. Language bindings expose the same option fields through native constructors or optional parameters.
*
* @throws Returns an error if the configured input-size limit is exceeded, HTML parsing fails,
* or the input contains invalid UTF-8.
*
* # Observability
*
* Emits an `html_to_markdown.convert` span at `INFO` level with fields `input_len`,
* `output_format`, `wrap`, `extract_metadata`, `extract_images`, and `tier_strategy`. These
* field names are part of the public observability contract and are kept stable across
* releases. This crate never installs a `tracing` subscriber — attach one in the consuming
* application to observe these spans and events.
*/
export declare function convert(html: string, options?: ConversionOptions | undefined | null): ConversionResult;
/**
* The type of an inline text annotation.
*
* Uses internally tagged representation (`"annotation_type": "bold"`) for JSON serialization.
*/
export type AnnotationKind =
| { annotation_type: "bold" }
| { annotation_type: "italic" }
| { annotation_type: "underline" }
| { annotation_type: "strikethrough" }
| { annotation_type: "code" }
| { annotation_type: "subscript" }
| { annotation_type: "superscript" }
| { annotation_type: "highlight" }
| { annotation_type: "link"; url: string; title: string };
/**
* Code block fence style in Markdown output.
*
* Determines how code blocks (`
`) are rendered in Markdown.
*/
export declare enum CodeBlockStyle {
/** Indented code blocks (4 spaces). `CommonMark` standard. */
Indented = "Indented",
/** Fenced code blocks with triple backticks. Default (GFM). Supports language hints. */
Backticks = "Backticks",
/** Fenced code blocks with tildes (~~~). Supports language hints. */
Tildes = "Tildes",
}
/**
* Main conversion options for HTML to Markdown conversion.
*
* Use `ConversionOptions.builder()` to construct, or `Default.default()` for defaults.
*/
export interface ConversionOptions {
/** Heading style to use in Markdown output (ATX `#` or Setext underline). */
readonly headingStyle?: HeadingStyle;
/** How to indent nested list items (spaces or tab). */
readonly listIndentType?: ListIndentType;
/** Number of spaces (or tabs) to use for each level of list indentation. */
readonly listIndentWidth?: number;
/** Bullet character(s) to use for unordered list items (e.g. `"-"`, `"*"`). */
readonly bullets?: string;
/** Character used for bold/italic emphasis markers (`*` or `_`). */
readonly strongEmSymbol?: string;
/** Escape `*` characters in plain text to avoid unintended bold/italic. */
readonly escapeAsterisks?: boolean;
/** Escape `_` characters in plain text to avoid unintended bold/italic. */
readonly escapeUnderscores?: boolean;
/** Escape miscellaneous Markdown metacharacters (`[]()#` etc.) in plain text. */
readonly escapeMisc?: boolean;
/** Escape ASCII characters that have special meaning in certain Markdown dialects. */
readonly escapeAscii?: boolean;
/** Default language annotation for fenced code blocks that have no language hint. */
readonly codeLanguage?: string;
/** Automatically convert bare URLs into Markdown autolinks. */
readonly autolinks?: boolean;
/** Append the title of an `` in parentheses (default `true`). */
readonly expandAbbreviations?: boolean;
/** Append the `cite` URL after a blockquote (default `true`). */
readonly includeBlockquoteCitations?: boolean;
/** Emit a default title when no `` tag is present. */
readonly defaultTitle?: boolean;
/** Render ` ` elements inside table cells as literal line breaks. */
readonly brInTables?: boolean;
/**
* Emit tables without column padding (compact GFM format).
*
* When `true`, column widths are not computed and cells are emitted with
* no trailing spaces. Separator rows use exactly `---` per column.
* Produces token-efficient output suitable for RAG / LLM contexts.
*
* Default `false` (aligned padding preserved).
*/
readonly compactTables?: boolean;
/** Style used for `` / highlighted text (e.g. `==text==`). */
readonly highlightStyle?: HighlightStyle;
/**
* Populate `result.metadata` with `` / `` extraction
* (title, description, Open Graph, Twitter Card, JSON-LD, …).
*
* Default `true`. Disabling skips the metadata pass only — table
* extraction into `result.tables` runs unconditionally.
*/
readonly extractMetadata?: boolean;
/**
* Controls how whitespace sequences are normalised in the converted output.
*
* - `WhitespaceMode.Normalized` (default) — collapses consecutive whitespace characters
* (spaces, tabs, newlines) to a single space, matching browser rendering behaviour.
* - `WhitespaceMode.Strict` — preserves all whitespace exactly as it appears in the
* source HTML, including runs of spaces and embedded newlines.
*
* Choose `Strict` only when the source HTML uses deliberate whitespace (e.g. pre-formatted
* content outside `
` tags). For most documents `Normalized` produces cleaner output.
*/
readonly whitespaceMode?: WhitespaceMode;
/** Strip all newlines from the output, producing a single-line result. */
readonly stripNewlines?: boolean;
/** Wrap long lines at `wrap_width` characters. */
readonly wrap?: boolean;
/**
* Maximum output line width in characters when `wrap` is `true` (default `80`).
*
* Lines are broken at word boundaries so that no line exceeds this length. A value of `0`
* is treated as "no limit" — equivalent to leaving `wrap` disabled. Has no
* effect when `wrap` is `false`.
*/
readonly wrapWidth?: number;
/** Treat the entire document as inline content (no block-level wrappers). */
readonly convertAsInline?: boolean;
/** Markdown notation for subscript text (e.g. `"~"`). */
readonly subSymbol?: string;
/** Markdown notation for superscript text (e.g. `"^"`). */
readonly supSymbol?: string;
/** How to encode hard line breaks (` `) in Markdown. */
readonly newlineStyle?: NewlineStyle;
/** Style used for fenced code blocks (backticks or tilde). */
readonly codeBlockStyle?: CodeBlockStyle;
/** HTML tag names whose `` children are kept inline instead of block. */
readonly keepInlineImagesIn?: Array;
/**
* Options for the HTML pre-processing pass applied before conversion begins.
*
* Pre-processing runs before the HTML is handed to the converter and can perform operations
* such as unwrapping redundant wrapper elements, removing tracking pixels, and normalising
* vendor-specific markup. See `PreprocessingOptions` for the full set of knobs.
*
* Defaults to `PreprocessingOptions.default()`, which enables the standard cleaning
* passes. Set individual fields on `PreprocessingOptions` (or construct via
* `ConversionOptions.builder`) to opt in or out of specific passes.
*/
readonly preprocessing?: PreprocessingOptions;
/** Expected character encoding of the input HTML (default `"utf-8"`). */
readonly encoding?: string;
/** Emit debug information during conversion. */
readonly debug?: boolean;
/** HTML tag names whose content is stripped from the output entirely. */
readonly stripTags?: Array;
/** HTML tag names that are preserved verbatim in the output. */
readonly preserveTags?: Array;
/** Skip conversion of `` elements (omit images from output). */
readonly skipImages?: boolean;
/**
* What the output shows for an image or embedded media element whose address is an inline
* `data:` URL: the URL with its payload (`InlineDataMedia.Keep`, the default), the alt
* text alone, or nothing. See `InlineDataMedia` for the elements it covers.
*/
readonly inlineDataMedia?: InlineDataMedia;
/**
* Which text that a browser does not show at first the output holds: none of it
* (`HiddenContent.Drop`, the default), the text a reader can get to in the page, such as
* an inactive tab panel (`HiddenContent.Reachable`), or that text and the content of
* `` and `