@kreuzberg/html-to-markdown-wasm 3.5.5 → 3.6.0-rc.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -126,6 +126,25 @@ const markdown = result.content;
126
126
  console.log(markdown);
127
127
  ```
128
128
 
129
+ ## Architecture
130
+
131
+ The converter routes each input through one of three tiers based on a fast prescan of the byte stream:
132
+
133
+ 1. **Tier-1 — single-pass byte scanner.** Handles 110+ HTML tags directly. Bails on any construct it cannot prove byte-equivalent to Tier-2.
134
+ 2. **Tier-2 — DOM walker.** Picks up Tier-1 bails and inputs the classifier rejected up front.
135
+ 3. **Tier-3 — standards-conformant parser.** Engaged for malformed HTML requiring full HTML5 repair.
136
+
137
+ The dispatcher is invisible to the caller. Output is byte-identical across tiers — enforced by a 116-snapshot oracle.
138
+
139
+ ## Capabilities
140
+
141
+ - **16 languages, one Rust core.** Rust, Python, Node.js, WASM, Java, Go, C#, PHP, Ruby, Elixir, R, Dart, Kotlin (Android), Swift, Zig, C ABI.
142
+ - **CommonMark-compatible Markdown** with GFM-style tables.
143
+ - **Djot output**: set `output_format = "djot"` (see Djot Output Format section below).
144
+ - **Real-HTML robust**: unclosed tags, CDATA, custom elements, malformed entities, nested tables, mixed encodings handled without losing content.
145
+ - **Metadata extraction**, **visitor API**, **inline images**, **configurable preprocessing presets**.
146
+ - **Per-group regression gates in CI**: every PR runs the bench harness against per-group thresholds.
147
+
129
148
  ## API Reference
130
149
 
131
150
  ### Core Function
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kreuzberg/html-to-markdown-wasm",
3
- "version": "3.5.5",
3
+ "version": "3.6.0-rc.2",
4
4
  "private": false,
5
5
  "description": "High-performance HTML to Markdown converter",
6
6
  "license": "MIT",
@@ -126,6 +126,25 @@ const markdown = result.content;
126
126
  console.log(markdown);
127
127
  ```
128
128
 
129
+ ## Architecture
130
+
131
+ The converter routes each input through one of three tiers based on a fast prescan of the byte stream:
132
+
133
+ 1. **Tier-1 — single-pass byte scanner.** Handles 110+ HTML tags directly. Bails on any construct it cannot prove byte-equivalent to Tier-2.
134
+ 2. **Tier-2 — DOM walker.** Picks up Tier-1 bails and inputs the classifier rejected up front.
135
+ 3. **Tier-3 — standards-conformant parser.** Engaged for malformed HTML requiring full HTML5 repair.
136
+
137
+ The dispatcher is invisible to the caller. Output is byte-identical across tiers — enforced by a 116-snapshot oracle.
138
+
139
+ ## Capabilities
140
+
141
+ - **16 languages, one Rust core.** Rust, Python, Node.js, WASM, Java, Go, C#, PHP, Ruby, Elixir, R, Dart, Kotlin (Android), Swift, Zig, C ABI.
142
+ - **CommonMark-compatible Markdown** with GFM-style tables.
143
+ - **Djot output**: set `output_format = "djot"` (see Djot Output Format section below).
144
+ - **Real-HTML robust**: unclosed tags, CDATA, custom elements, malformed entities, nested tables, mixed encodings handled without losing content.
145
+ - **Metadata extraction**, **visitor API**, **inline images**, **configurable preprocessing presets**.
146
+ - **Per-group regression gates in CI**: every PR runs the bench harness against per-group thresholds.
147
+
129
148
  ## API Reference
130
149
 
131
150
  ### Core Function
@@ -40,7 +40,7 @@ export class WasmConversionOptions {
40
40
  free(): void;
41
41
  [Symbol.dispose](): void;
42
42
  static default(): WasmConversionOptions;
43
- constructor(headingStyle?: WasmHeadingStyle | null, listIndentType?: WasmListIndentType | null, listIndentWidth?: number | null, bullets?: string | null, strongEmSymbol?: string | null, escapeAsterisks?: boolean | null, escapeUnderscores?: boolean | null, escapeMisc?: boolean | null, escapeAscii?: boolean | null, codeLanguage?: string | null, autolinks?: boolean | null, defaultTitle?: boolean | null, brInTables?: boolean | null, compactTables?: boolean | null, highlightStyle?: WasmHighlightStyle | null, extractMetadata?: boolean | null, whitespaceMode?: WasmWhitespaceMode | null, stripNewlines?: boolean | null, wrap?: boolean | null, wrapWidth?: number | null, convertAsInline?: boolean | null, subSymbol?: string | null, supSymbol?: string | null, newlineStyle?: WasmNewlineStyle | null, codeBlockStyle?: WasmCodeBlockStyle | null, keepInlineImagesIn?: string[] | null, preprocessing?: WasmPreprocessingOptions | null, encoding?: string | null, debug?: boolean | null, stripTags?: string[] | null, preserveTags?: string[] | null, skipImages?: boolean | null, linkStyle?: WasmLinkStyle | null, outputFormat?: WasmOutputFormat | null, includeDocumentStructure?: boolean | null, extractImages?: boolean | null, maxImageSize?: bigint | null, captureSvg?: boolean | null, inferDimensions?: boolean | null, excludeSelectors?: string[] | null, maxDepth?: number | null);
43
+ constructor(headingStyle?: WasmHeadingStyle | null, listIndentType?: WasmListIndentType | null, listIndentWidth?: number | null, bullets?: string | null, strongEmSymbol?: string | null, escapeAsterisks?: boolean | null, escapeUnderscores?: boolean | null, escapeMisc?: boolean | null, escapeAscii?: boolean | null, codeLanguage?: string | null, autolinks?: boolean | null, defaultTitle?: boolean | null, brInTables?: boolean | null, compactTables?: boolean | null, highlightStyle?: WasmHighlightStyle | null, extractMetadata?: boolean | null, whitespaceMode?: WasmWhitespaceMode | null, stripNewlines?: boolean | null, wrap?: boolean | null, wrapWidth?: number | null, convertAsInline?: boolean | null, subSymbol?: string | null, supSymbol?: string | null, newlineStyle?: WasmNewlineStyle | null, codeBlockStyle?: WasmCodeBlockStyle | null, keepInlineImagesIn?: string[] | null, preprocessing?: WasmPreprocessingOptions | null, encoding?: string | null, debug?: boolean | null, stripTags?: string[] | null, preserveTags?: string[] | null, skipImages?: boolean | null, urlEscapeStyle?: WasmUrlEscapeStyle | null, linkStyle?: WasmLinkStyle | null, outputFormat?: WasmOutputFormat | null, includeDocumentStructure?: boolean | null, extractImages?: boolean | null, maxImageSize?: bigint | null, captureSvg?: boolean | null, inferDimensions?: boolean | null, excludeSelectors?: string[] | null, tierStrategy?: WasmTierStrategy | null, maxDepth?: number | null);
44
44
  autolinks: boolean;
45
45
  brInTables: boolean;
46
46
  bullets: string;
@@ -87,6 +87,10 @@ export class WasmConversionOptions {
87
87
  strongEmSymbol: string;
88
88
  subSymbol: string;
89
89
  supSymbol: string;
90
+ get tierStrategy(): string;
91
+ set tierStrategy(value: WasmTierStrategy);
92
+ get urlEscapeStyle(): string;
93
+ set urlEscapeStyle(value: WasmUrlEscapeStyle);
90
94
  get visitor(): WasmVisitorHandle | undefined;
91
95
  set visitor(value: WasmVisitorHandle | null | undefined);
92
96
  get whitespaceMode(): string;
@@ -105,7 +109,7 @@ export class WasmConversionOptionsUpdate {
105
109
  free(): void;
106
110
  [Symbol.dispose](): void;
107
111
  static default(): WasmConversionOptionsUpdate;
108
- constructor(headingStyle?: WasmHeadingStyle | null, listIndentType?: WasmListIndentType | null, listIndentWidth?: number | null, bullets?: string | null, strongEmSymbol?: string | null, escapeAsterisks?: boolean | null, escapeUnderscores?: boolean | null, escapeMisc?: boolean | null, escapeAscii?: boolean | null, codeLanguage?: string | null, autolinks?: boolean | null, defaultTitle?: boolean | null, brInTables?: boolean | null, compactTables?: boolean | null, highlightStyle?: WasmHighlightStyle | null, extractMetadata?: boolean | null, whitespaceMode?: WasmWhitespaceMode | null, stripNewlines?: boolean | null, wrap?: boolean | null, wrapWidth?: number | null, convertAsInline?: boolean | null, subSymbol?: string | null, supSymbol?: string | null, newlineStyle?: WasmNewlineStyle | null, codeBlockStyle?: WasmCodeBlockStyle | null, keepInlineImagesIn?: string[] | null, preprocessing?: WasmPreprocessingOptionsUpdate | null, encoding?: string | null, debug?: boolean | null, stripTags?: string[] | null, preserveTags?: string[] | null, skipImages?: boolean | null, linkStyle?: WasmLinkStyle | null, outputFormat?: WasmOutputFormat | null, includeDocumentStructure?: boolean | null, extractImages?: boolean | null, maxImageSize?: bigint | null, captureSvg?: boolean | null, inferDimensions?: boolean | null, maxDepth?: number | null, excludeSelectors?: string[] | null);
112
+ constructor(headingStyle?: WasmHeadingStyle | null, listIndentType?: WasmListIndentType | null, listIndentWidth?: number | null, bullets?: string | null, strongEmSymbol?: string | null, escapeAsterisks?: boolean | null, escapeUnderscores?: boolean | null, escapeMisc?: boolean | null, escapeAscii?: boolean | null, codeLanguage?: string | null, autolinks?: boolean | null, defaultTitle?: boolean | null, brInTables?: boolean | null, compactTables?: boolean | null, highlightStyle?: WasmHighlightStyle | null, extractMetadata?: boolean | null, whitespaceMode?: WasmWhitespaceMode | null, stripNewlines?: boolean | null, wrap?: boolean | null, wrapWidth?: number | null, convertAsInline?: boolean | null, subSymbol?: string | null, supSymbol?: string | null, newlineStyle?: WasmNewlineStyle | null, codeBlockStyle?: WasmCodeBlockStyle | null, keepInlineImagesIn?: string[] | null, preprocessing?: WasmPreprocessingOptionsUpdate | null, encoding?: string | null, debug?: boolean | null, stripTags?: string[] | null, preserveTags?: string[] | null, skipImages?: boolean | null, urlEscapeStyle?: WasmUrlEscapeStyle | null, linkStyle?: WasmLinkStyle | null, outputFormat?: WasmOutputFormat | null, includeDocumentStructure?: boolean | null, extractImages?: boolean | null, maxImageSize?: bigint | null, captureSvg?: boolean | null, inferDimensions?: boolean | null, maxDepth?: number | null, excludeSelectors?: string[] | null, tierStrategy?: WasmTierStrategy | null);
109
113
  get autolinks(): boolean | undefined;
110
114
  set autolinks(value: boolean | null | undefined);
111
115
  get brInTables(): boolean | undefined;
@@ -182,6 +186,10 @@ export class WasmConversionOptionsUpdate {
182
186
  set subSymbol(value: string | null | undefined);
183
187
  get supSymbol(): string | undefined;
184
188
  set supSymbol(value: string | null | undefined);
189
+ get tierStrategy(): string | undefined;
190
+ set tierStrategy(value: WasmTierStrategy | null | undefined);
191
+ get urlEscapeStyle(): string | undefined;
192
+ set urlEscapeStyle(value: WasmUrlEscapeStyle | null | undefined);
185
193
  get visitor(): WasmVisitorHandle | undefined;
186
194
  set visitor(value: WasmVisitorHandle | null | undefined);
187
195
  get whitespaceMode(): string | undefined;
@@ -826,6 +834,34 @@ export enum WasmTextDirection {
826
834
  Auto = 2,
827
835
  }
828
836
 
837
+ /**
838
+ * Controls which conversion tier is used.
839
+ */
840
+ export enum WasmTierStrategy {
841
+ Auto = 0,
842
+ Tier2 = 1,
843
+ Tier1 = 2,
844
+ }
845
+
846
+ /**
847
+ * URL encoding strategy for link and image destinations.
848
+ *
849
+ * Controls how special characters in URL destinations are handled when they
850
+ * require escaping to produce valid Markdown.
851
+ *
852
+ * The `Angle` variant (default) wraps the destination in angle brackets:
853
+ * `[text](<url with spaces>)`. This is the CommonMark-specified escape hatch
854
+ * but breaks when the URL itself contains `>`.
855
+ *
856
+ * The `Percent` variant percent-encodes every character that is not an RFC 3986
857
+ * unreserved character or `/`, producing a destination safe for all Markdown
858
+ * parsers: `[text](url%20with%20spaces)`.
859
+ */
860
+ export enum WasmUrlEscapeStyle {
861
+ Angle = 0,
862
+ Percent = 1,
863
+ }
864
+
829
865
  /**
830
866
  * Result of a visitor callback.
831
867
  *
@@ -884,7 +920,12 @@ export enum WasmWhitespaceMode {
884
920
  * # Arguments
885
921
  *
886
922
  * * `html` — the HTML string to convert.
887
- * * `options` — optional conversion options. Defaults to `ConversionOptions.default`.
923
+ * * `options` — conversion options. The parameter bound is
924
+ * `impl Into<Option<ConversionOptions>>`, so any of the following call shapes are accepted:
925
+ * - `convert(html, ConversionOptions.default())` — bare options.
926
+ * - `convert(html, opts)` — bare options.
927
+ * - `convert(html, Some(opts))` — explicit `Option`.
928
+ * - `convert(html, None)` — fall back to `ConversionOptions.default`.
888
929
  *
889
930
  * # Example
890
931
  *
@@ -5,5 +5,5 @@ import { __wbg_set_wasm } from "./html_to_markdown_wasm_bg.js";
5
5
  __wbg_set_wasm(wasm);
6
6
 
7
7
  export {
8
- WasmAnnotationKind, WasmCodeBlockStyle, WasmConversionOptions, WasmConversionOptionsUpdate, WasmConversionResult, WasmDocumentMetadata, WasmDocumentNode, WasmDocumentStructure, WasmGridCell, WasmHeaderMetadata, WasmHeadingStyle, WasmHighlightStyle, WasmHtmlMetadata, WasmImageMetadata, WasmImageType, WasmLinkMetadata, WasmLinkStyle, WasmLinkType, WasmListIndentType, WasmNewlineStyle, WasmNodeContent, WasmNodeContext, WasmNodeType, WasmOutputFormat, WasmPreprocessingOptions, WasmPreprocessingOptionsUpdate, WasmPreprocessingPreset, WasmProcessingWarning, WasmStructuredData, WasmStructuredDataType, WasmTableData, WasmTableGrid, WasmTextAnnotation, WasmTextDirection, WasmVisitResult, WasmVisitorHandle, WasmWarningKind, WasmWhitespaceMode, convert
8
+ WasmAnnotationKind, WasmCodeBlockStyle, WasmConversionOptions, WasmConversionOptionsUpdate, WasmConversionResult, WasmDocumentMetadata, WasmDocumentNode, WasmDocumentStructure, WasmGridCell, WasmHeaderMetadata, WasmHeadingStyle, WasmHighlightStyle, WasmHtmlMetadata, WasmImageMetadata, WasmImageType, WasmLinkMetadata, WasmLinkStyle, WasmLinkType, WasmListIndentType, WasmNewlineStyle, WasmNodeContent, WasmNodeContext, WasmNodeType, WasmOutputFormat, WasmPreprocessingOptions, WasmPreprocessingOptionsUpdate, WasmPreprocessingPreset, WasmProcessingWarning, WasmStructuredData, WasmStructuredDataType, WasmTableData, WasmTableGrid, WasmTextAnnotation, WasmTextDirection, WasmTierStrategy, WasmUrlEscapeStyle, WasmVisitResult, WasmVisitorHandle, WasmWarningKind, WasmWhitespaceMode, convert
9
9
  } from "./html_to_markdown_wasm_bg.js";
@@ -503,6 +503,7 @@ export class WasmConversionOptions {
503
503
  * @param {string[] | null} [stripTags]
504
504
  * @param {string[] | null} [preserveTags]
505
505
  * @param {boolean | null} [skipImages]
506
+ * @param {WasmUrlEscapeStyle | null} [urlEscapeStyle]
506
507
  * @param {WasmLinkStyle | null} [linkStyle]
507
508
  * @param {WasmOutputFormat | null} [outputFormat]
508
509
  * @param {boolean | null} [includeDocumentStructure]
@@ -511,9 +512,10 @@ export class WasmConversionOptions {
511
512
  * @param {boolean | null} [captureSvg]
512
513
  * @param {boolean | null} [inferDimensions]
513
514
  * @param {string[] | null} [excludeSelectors]
515
+ * @param {WasmTierStrategy | null} [tierStrategy]
514
516
  * @param {number | null} [maxDepth]
515
517
  */
516
- constructor(headingStyle, listIndentType, listIndentWidth, bullets, strongEmSymbol, escapeAsterisks, escapeUnderscores, escapeMisc, escapeAscii, codeLanguage, autolinks, defaultTitle, brInTables, compactTables, highlightStyle, extractMetadata, whitespaceMode, stripNewlines, wrap, wrapWidth, convertAsInline, subSymbol, supSymbol, newlineStyle, codeBlockStyle, keepInlineImagesIn, preprocessing, encoding, debug, stripTags, preserveTags, skipImages, linkStyle, outputFormat, includeDocumentStructure, extractImages, maxImageSize, captureSvg, inferDimensions, excludeSelectors, maxDepth) {
518
+ constructor(headingStyle, listIndentType, listIndentWidth, bullets, strongEmSymbol, escapeAsterisks, escapeUnderscores, escapeMisc, escapeAscii, codeLanguage, autolinks, defaultTitle, brInTables, compactTables, highlightStyle, extractMetadata, whitespaceMode, stripNewlines, wrap, wrapWidth, convertAsInline, subSymbol, supSymbol, newlineStyle, codeBlockStyle, keepInlineImagesIn, preprocessing, encoding, debug, stripTags, preserveTags, skipImages, urlEscapeStyle, linkStyle, outputFormat, includeDocumentStructure, extractImages, maxImageSize, captureSvg, inferDimensions, excludeSelectors, tierStrategy, maxDepth) {
517
519
  var ptr0 = isLikeNone(bullets) ? 0 : passStringToWasm0(bullets, wasm.__wbindgen_export, wasm.__wbindgen_export2);
518
520
  var len0 = WASM_VECTOR_LEN;
519
521
  var ptr1 = isLikeNone(strongEmSymbol) ? 0 : passStringToWasm0(strongEmSymbol, wasm.__wbindgen_export, wasm.__wbindgen_export2);
@@ -539,7 +541,7 @@ export class WasmConversionOptions {
539
541
  var len9 = WASM_VECTOR_LEN;
540
542
  var ptr10 = isLikeNone(excludeSelectors) ? 0 : passArrayJsValueToWasm0(excludeSelectors, wasm.__wbindgen_export);
541
543
  var len10 = WASM_VECTOR_LEN;
542
- const ret = wasm.wasmconversionoptions_new(isLikeNone(headingStyle) ? 3 : headingStyle, isLikeNone(listIndentType) ? 2 : listIndentType, isLikeNone(listIndentWidth) ? Number.MAX_SAFE_INTEGER : (listIndentWidth) >>> 0, ptr0, len0, ptr1, len1, isLikeNone(escapeAsterisks) ? 0xFFFFFF : escapeAsterisks ? 1 : 0, isLikeNone(escapeUnderscores) ? 0xFFFFFF : escapeUnderscores ? 1 : 0, isLikeNone(escapeMisc) ? 0xFFFFFF : escapeMisc ? 1 : 0, isLikeNone(escapeAscii) ? 0xFFFFFF : escapeAscii ? 1 : 0, ptr2, len2, isLikeNone(autolinks) ? 0xFFFFFF : autolinks ? 1 : 0, isLikeNone(defaultTitle) ? 0xFFFFFF : defaultTitle ? 1 : 0, isLikeNone(brInTables) ? 0xFFFFFF : brInTables ? 1 : 0, isLikeNone(compactTables) ? 0xFFFFFF : compactTables ? 1 : 0, isLikeNone(highlightStyle) ? 4 : highlightStyle, isLikeNone(extractMetadata) ? 0xFFFFFF : extractMetadata ? 1 : 0, isLikeNone(whitespaceMode) ? 2 : whitespaceMode, isLikeNone(stripNewlines) ? 0xFFFFFF : stripNewlines ? 1 : 0, isLikeNone(wrap) ? 0xFFFFFF : wrap ? 1 : 0, isLikeNone(wrapWidth) ? Number.MAX_SAFE_INTEGER : (wrapWidth) >>> 0, isLikeNone(convertAsInline) ? 0xFFFFFF : convertAsInline ? 1 : 0, ptr3, len3, ptr4, len4, isLikeNone(newlineStyle) ? 2 : newlineStyle, isLikeNone(codeBlockStyle) ? 3 : codeBlockStyle, ptr5, len5, ptr6, ptr7, len7, isLikeNone(debug) ? 0xFFFFFF : debug ? 1 : 0, ptr8, len8, ptr9, len9, isLikeNone(skipImages) ? 0xFFFFFF : skipImages ? 1 : 0, isLikeNone(linkStyle) ? 2 : linkStyle, isLikeNone(outputFormat) ? 3 : outputFormat, isLikeNone(includeDocumentStructure) ? 0xFFFFFF : includeDocumentStructure ? 1 : 0, isLikeNone(extractImages) ? 0xFFFFFF : extractImages ? 1 : 0, !isLikeNone(maxImageSize), isLikeNone(maxImageSize) ? BigInt(0) : maxImageSize, isLikeNone(captureSvg) ? 0xFFFFFF : captureSvg ? 1 : 0, isLikeNone(inferDimensions) ? 0xFFFFFF : inferDimensions ? 1 : 0, ptr10, len10, isLikeNone(maxDepth) ? Number.MAX_SAFE_INTEGER : (maxDepth) >>> 0);
544
+ const ret = wasm.wasmconversionoptions_new(isLikeNone(headingStyle) ? 3 : headingStyle, isLikeNone(listIndentType) ? 2 : listIndentType, isLikeNone(listIndentWidth) ? Number.MAX_SAFE_INTEGER : (listIndentWidth) >>> 0, ptr0, len0, ptr1, len1, isLikeNone(escapeAsterisks) ? 0xFFFFFF : escapeAsterisks ? 1 : 0, isLikeNone(escapeUnderscores) ? 0xFFFFFF : escapeUnderscores ? 1 : 0, isLikeNone(escapeMisc) ? 0xFFFFFF : escapeMisc ? 1 : 0, isLikeNone(escapeAscii) ? 0xFFFFFF : escapeAscii ? 1 : 0, ptr2, len2, isLikeNone(autolinks) ? 0xFFFFFF : autolinks ? 1 : 0, isLikeNone(defaultTitle) ? 0xFFFFFF : defaultTitle ? 1 : 0, isLikeNone(brInTables) ? 0xFFFFFF : brInTables ? 1 : 0, isLikeNone(compactTables) ? 0xFFFFFF : compactTables ? 1 : 0, isLikeNone(highlightStyle) ? 4 : highlightStyle, isLikeNone(extractMetadata) ? 0xFFFFFF : extractMetadata ? 1 : 0, isLikeNone(whitespaceMode) ? 2 : whitespaceMode, isLikeNone(stripNewlines) ? 0xFFFFFF : stripNewlines ? 1 : 0, isLikeNone(wrap) ? 0xFFFFFF : wrap ? 1 : 0, isLikeNone(wrapWidth) ? Number.MAX_SAFE_INTEGER : (wrapWidth) >>> 0, isLikeNone(convertAsInline) ? 0xFFFFFF : convertAsInline ? 1 : 0, ptr3, len3, ptr4, len4, isLikeNone(newlineStyle) ? 2 : newlineStyle, isLikeNone(codeBlockStyle) ? 3 : codeBlockStyle, ptr5, len5, ptr6, ptr7, len7, isLikeNone(debug) ? 0xFFFFFF : debug ? 1 : 0, ptr8, len8, ptr9, len9, isLikeNone(skipImages) ? 0xFFFFFF : skipImages ? 1 : 0, isLikeNone(urlEscapeStyle) ? 2 : urlEscapeStyle, isLikeNone(linkStyle) ? 2 : linkStyle, isLikeNone(outputFormat) ? 3 : outputFormat, isLikeNone(includeDocumentStructure) ? 0xFFFFFF : includeDocumentStructure ? 1 : 0, isLikeNone(extractImages) ? 0xFFFFFF : extractImages ? 1 : 0, !isLikeNone(maxImageSize), isLikeNone(maxImageSize) ? BigInt(0) : maxImageSize, isLikeNone(captureSvg) ? 0xFFFFFF : captureSvg ? 1 : 0, isLikeNone(inferDimensions) ? 0xFFFFFF : inferDimensions ? 1 : 0, ptr10, len10, isLikeNone(tierStrategy) ? 3 : tierStrategy, isLikeNone(maxDepth) ? Number.MAX_SAFE_INTEGER : (maxDepth) >>> 0);
543
545
  this.__wbg_ptr = ret;
544
546
  WasmConversionOptionsFinalization.register(this, this.__wbg_ptr, this);
545
547
  return this;
@@ -855,6 +857,18 @@ export class WasmConversionOptions {
855
857
  const len0 = WASM_VECTOR_LEN;
856
858
  wasm.wasmconversionoptions_set_supSymbol(this.__wbg_ptr, ptr0, len0);
857
859
  }
860
+ /**
861
+ * @param {WasmTierStrategy} value
862
+ */
863
+ set tierStrategy(value) {
864
+ wasm.wasmconversionoptions_set_tierStrategy(this.__wbg_ptr, value);
865
+ }
866
+ /**
867
+ * @param {WasmUrlEscapeStyle} value
868
+ */
869
+ set urlEscapeStyle(value) {
870
+ wasm.wasmconversionoptions_set_urlEscapeStyle(this.__wbg_ptr, value);
871
+ }
858
872
  /**
859
873
  * @param {WasmVisitorHandle | null} [value]
860
874
  */
@@ -971,6 +985,44 @@ export class WasmConversionOptions {
971
985
  wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
972
986
  }
973
987
  }
988
+ /**
989
+ * @returns {string}
990
+ */
991
+ get tierStrategy() {
992
+ let deferred1_0;
993
+ let deferred1_1;
994
+ try {
995
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
996
+ wasm.wasmconversionoptions_tierStrategy(retptr, this.__wbg_ptr);
997
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
998
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
999
+ deferred1_0 = r0;
1000
+ deferred1_1 = r1;
1001
+ return getStringFromWasm0(r0, r1);
1002
+ } finally {
1003
+ wasm.__wbindgen_add_to_stack_pointer(16);
1004
+ wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
1005
+ }
1006
+ }
1007
+ /**
1008
+ * @returns {string}
1009
+ */
1010
+ get urlEscapeStyle() {
1011
+ let deferred1_0;
1012
+ let deferred1_1;
1013
+ try {
1014
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1015
+ wasm.wasmconversionoptions_urlEscapeStyle(retptr, this.__wbg_ptr);
1016
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1017
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1018
+ deferred1_0 = r0;
1019
+ deferred1_1 = r1;
1020
+ return getStringFromWasm0(r0, r1);
1021
+ } finally {
1022
+ wasm.__wbindgen_add_to_stack_pointer(16);
1023
+ wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
1024
+ }
1025
+ }
974
1026
  /**
975
1027
  * @returns {WasmVisitorHandle | undefined}
976
1028
  */
@@ -1400,6 +1452,7 @@ export class WasmConversionOptionsUpdate {
1400
1452
  * @param {string[] | null} [stripTags]
1401
1453
  * @param {string[] | null} [preserveTags]
1402
1454
  * @param {boolean | null} [skipImages]
1455
+ * @param {WasmUrlEscapeStyle | null} [urlEscapeStyle]
1403
1456
  * @param {WasmLinkStyle | null} [linkStyle]
1404
1457
  * @param {WasmOutputFormat | null} [outputFormat]
1405
1458
  * @param {boolean | null} [includeDocumentStructure]
@@ -1409,8 +1462,9 @@ export class WasmConversionOptionsUpdate {
1409
1462
  * @param {boolean | null} [inferDimensions]
1410
1463
  * @param {number | null} [maxDepth]
1411
1464
  * @param {string[] | null} [excludeSelectors]
1465
+ * @param {WasmTierStrategy | null} [tierStrategy]
1412
1466
  */
1413
- constructor(headingStyle, listIndentType, listIndentWidth, bullets, strongEmSymbol, escapeAsterisks, escapeUnderscores, escapeMisc, escapeAscii, codeLanguage, autolinks, defaultTitle, brInTables, compactTables, highlightStyle, extractMetadata, whitespaceMode, stripNewlines, wrap, wrapWidth, convertAsInline, subSymbol, supSymbol, newlineStyle, codeBlockStyle, keepInlineImagesIn, preprocessing, encoding, debug, stripTags, preserveTags, skipImages, linkStyle, outputFormat, includeDocumentStructure, extractImages, maxImageSize, captureSvg, inferDimensions, maxDepth, excludeSelectors) {
1467
+ constructor(headingStyle, listIndentType, listIndentWidth, bullets, strongEmSymbol, escapeAsterisks, escapeUnderscores, escapeMisc, escapeAscii, codeLanguage, autolinks, defaultTitle, brInTables, compactTables, highlightStyle, extractMetadata, whitespaceMode, stripNewlines, wrap, wrapWidth, convertAsInline, subSymbol, supSymbol, newlineStyle, codeBlockStyle, keepInlineImagesIn, preprocessing, encoding, debug, stripTags, preserveTags, skipImages, urlEscapeStyle, linkStyle, outputFormat, includeDocumentStructure, extractImages, maxImageSize, captureSvg, inferDimensions, maxDepth, excludeSelectors, tierStrategy) {
1414
1468
  var ptr0 = isLikeNone(bullets) ? 0 : passStringToWasm0(bullets, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1415
1469
  var len0 = WASM_VECTOR_LEN;
1416
1470
  var ptr1 = isLikeNone(strongEmSymbol) ? 0 : passStringToWasm0(strongEmSymbol, wasm.__wbindgen_export, wasm.__wbindgen_export2);
@@ -1436,7 +1490,7 @@ export class WasmConversionOptionsUpdate {
1436
1490
  var len9 = WASM_VECTOR_LEN;
1437
1491
  var ptr10 = isLikeNone(excludeSelectors) ? 0 : passArrayJsValueToWasm0(excludeSelectors, wasm.__wbindgen_export);
1438
1492
  var len10 = WASM_VECTOR_LEN;
1439
- const ret = wasm.wasmconversionoptionsupdate_new(isLikeNone(headingStyle) ? 3 : headingStyle, isLikeNone(listIndentType) ? 2 : listIndentType, isLikeNone(listIndentWidth) ? Number.MAX_SAFE_INTEGER : (listIndentWidth) >>> 0, ptr0, len0, ptr1, len1, isLikeNone(escapeAsterisks) ? 0xFFFFFF : escapeAsterisks ? 1 : 0, isLikeNone(escapeUnderscores) ? 0xFFFFFF : escapeUnderscores ? 1 : 0, isLikeNone(escapeMisc) ? 0xFFFFFF : escapeMisc ? 1 : 0, isLikeNone(escapeAscii) ? 0xFFFFFF : escapeAscii ? 1 : 0, ptr2, len2, isLikeNone(autolinks) ? 0xFFFFFF : autolinks ? 1 : 0, isLikeNone(defaultTitle) ? 0xFFFFFF : defaultTitle ? 1 : 0, isLikeNone(brInTables) ? 0xFFFFFF : brInTables ? 1 : 0, isLikeNone(compactTables) ? 0xFFFFFF : compactTables ? 1 : 0, isLikeNone(highlightStyle) ? 4 : highlightStyle, isLikeNone(extractMetadata) ? 0xFFFFFF : extractMetadata ? 1 : 0, isLikeNone(whitespaceMode) ? 2 : whitespaceMode, isLikeNone(stripNewlines) ? 0xFFFFFF : stripNewlines ? 1 : 0, isLikeNone(wrap) ? 0xFFFFFF : wrap ? 1 : 0, isLikeNone(wrapWidth) ? Number.MAX_SAFE_INTEGER : (wrapWidth) >>> 0, isLikeNone(convertAsInline) ? 0xFFFFFF : convertAsInline ? 1 : 0, ptr3, len3, ptr4, len4, isLikeNone(newlineStyle) ? 2 : newlineStyle, isLikeNone(codeBlockStyle) ? 3 : codeBlockStyle, ptr5, len5, ptr6, ptr7, len7, isLikeNone(debug) ? 0xFFFFFF : debug ? 1 : 0, ptr8, len8, ptr9, len9, isLikeNone(skipImages) ? 0xFFFFFF : skipImages ? 1 : 0, isLikeNone(linkStyle) ? 2 : linkStyle, isLikeNone(outputFormat) ? 3 : outputFormat, isLikeNone(includeDocumentStructure) ? 0xFFFFFF : includeDocumentStructure ? 1 : 0, isLikeNone(extractImages) ? 0xFFFFFF : extractImages ? 1 : 0, !isLikeNone(maxImageSize), isLikeNone(maxImageSize) ? BigInt(0) : maxImageSize, isLikeNone(captureSvg) ? 0xFFFFFF : captureSvg ? 1 : 0, isLikeNone(inferDimensions) ? 0xFFFFFF : inferDimensions ? 1 : 0, isLikeNone(maxDepth) ? Number.MAX_SAFE_INTEGER : (maxDepth) >>> 0, ptr10, len10);
1493
+ const ret = wasm.wasmconversionoptionsupdate_new(isLikeNone(headingStyle) ? 3 : headingStyle, isLikeNone(listIndentType) ? 2 : listIndentType, isLikeNone(listIndentWidth) ? Number.MAX_SAFE_INTEGER : (listIndentWidth) >>> 0, ptr0, len0, ptr1, len1, isLikeNone(escapeAsterisks) ? 0xFFFFFF : escapeAsterisks ? 1 : 0, isLikeNone(escapeUnderscores) ? 0xFFFFFF : escapeUnderscores ? 1 : 0, isLikeNone(escapeMisc) ? 0xFFFFFF : escapeMisc ? 1 : 0, isLikeNone(escapeAscii) ? 0xFFFFFF : escapeAscii ? 1 : 0, ptr2, len2, isLikeNone(autolinks) ? 0xFFFFFF : autolinks ? 1 : 0, isLikeNone(defaultTitle) ? 0xFFFFFF : defaultTitle ? 1 : 0, isLikeNone(brInTables) ? 0xFFFFFF : brInTables ? 1 : 0, isLikeNone(compactTables) ? 0xFFFFFF : compactTables ? 1 : 0, isLikeNone(highlightStyle) ? 4 : highlightStyle, isLikeNone(extractMetadata) ? 0xFFFFFF : extractMetadata ? 1 : 0, isLikeNone(whitespaceMode) ? 2 : whitespaceMode, isLikeNone(stripNewlines) ? 0xFFFFFF : stripNewlines ? 1 : 0, isLikeNone(wrap) ? 0xFFFFFF : wrap ? 1 : 0, isLikeNone(wrapWidth) ? Number.MAX_SAFE_INTEGER : (wrapWidth) >>> 0, isLikeNone(convertAsInline) ? 0xFFFFFF : convertAsInline ? 1 : 0, ptr3, len3, ptr4, len4, isLikeNone(newlineStyle) ? 2 : newlineStyle, isLikeNone(codeBlockStyle) ? 3 : codeBlockStyle, ptr5, len5, ptr6, ptr7, len7, isLikeNone(debug) ? 0xFFFFFF : debug ? 1 : 0, ptr8, len8, ptr9, len9, isLikeNone(skipImages) ? 0xFFFFFF : skipImages ? 1 : 0, isLikeNone(urlEscapeStyle) ? 2 : urlEscapeStyle, isLikeNone(linkStyle) ? 2 : linkStyle, isLikeNone(outputFormat) ? 3 : outputFormat, isLikeNone(includeDocumentStructure) ? 0xFFFFFF : includeDocumentStructure ? 1 : 0, isLikeNone(extractImages) ? 0xFFFFFF : extractImages ? 1 : 0, !isLikeNone(maxImageSize), isLikeNone(maxImageSize) ? BigInt(0) : maxImageSize, isLikeNone(captureSvg) ? 0xFFFFFF : captureSvg ? 1 : 0, isLikeNone(inferDimensions) ? 0xFFFFFF : inferDimensions ? 1 : 0, isLikeNone(maxDepth) ? Number.MAX_SAFE_INTEGER : (maxDepth) >>> 0, ptr10, len10, isLikeNone(tierStrategy) ? 3 : tierStrategy);
1440
1494
  this.__wbg_ptr = ret;
1441
1495
  WasmConversionOptionsUpdateFinalization.register(this, this.__wbg_ptr, this);
1442
1496
  return this;
@@ -1758,6 +1812,18 @@ export class WasmConversionOptionsUpdate {
1758
1812
  var len0 = WASM_VECTOR_LEN;
1759
1813
  wasm.wasmconversionoptionsupdate_set_supSymbol(this.__wbg_ptr, ptr0, len0);
1760
1814
  }
1815
+ /**
1816
+ * @param {WasmTierStrategy | null} [value]
1817
+ */
1818
+ set tierStrategy(value) {
1819
+ wasm.wasmconversionoptionsupdate_set_tierStrategy(this.__wbg_ptr, isLikeNone(value) ? 3 : value);
1820
+ }
1821
+ /**
1822
+ * @param {WasmUrlEscapeStyle | null} [value]
1823
+ */
1824
+ set urlEscapeStyle(value) {
1825
+ wasm.wasmconversionoptionsupdate_set_urlEscapeStyle(this.__wbg_ptr, isLikeNone(value) ? 2 : value);
1826
+ }
1761
1827
  /**
1762
1828
  * @param {WasmVisitorHandle | null} [value]
1763
1829
  */
@@ -1877,6 +1943,44 @@ export class WasmConversionOptionsUpdate {
1877
1943
  wasm.__wbindgen_add_to_stack_pointer(16);
1878
1944
  }
1879
1945
  }
1946
+ /**
1947
+ * @returns {string | undefined}
1948
+ */
1949
+ get tierStrategy() {
1950
+ try {
1951
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1952
+ wasm.wasmconversionoptionsupdate_tierStrategy(retptr, this.__wbg_ptr);
1953
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1954
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1955
+ let v1;
1956
+ if (r0 !== 0) {
1957
+ v1 = getStringFromWasm0(r0, r1).slice();
1958
+ wasm.__wbindgen_export4(r0, r1 * 1, 1);
1959
+ }
1960
+ return v1;
1961
+ } finally {
1962
+ wasm.__wbindgen_add_to_stack_pointer(16);
1963
+ }
1964
+ }
1965
+ /**
1966
+ * @returns {string | undefined}
1967
+ */
1968
+ get urlEscapeStyle() {
1969
+ try {
1970
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1971
+ wasm.wasmconversionoptionsupdate_urlEscapeStyle(retptr, this.__wbg_ptr);
1972
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1973
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1974
+ let v1;
1975
+ if (r0 !== 0) {
1976
+ v1 = getStringFromWasm0(r0, r1).slice();
1977
+ wasm.__wbindgen_export4(r0, r1 * 1, 1);
1978
+ }
1979
+ return v1;
1980
+ } finally {
1981
+ wasm.__wbindgen_add_to_stack_pointer(16);
1982
+ }
1983
+ }
1880
1984
  /**
1881
1985
  * @returns {WasmVisitorHandle | undefined}
1882
1986
  */
@@ -5181,6 +5285,36 @@ export const WasmTextDirection = Object.freeze({
5181
5285
  Auto: 2, "2": "Auto",
5182
5286
  });
5183
5287
 
5288
+ /**
5289
+ * Controls which conversion tier is used.
5290
+ * @enum {0 | 1 | 2}
5291
+ */
5292
+ export const WasmTierStrategy = Object.freeze({
5293
+ Auto: 0, "0": "Auto",
5294
+ Tier2: 1, "1": "Tier2",
5295
+ Tier1: 2, "2": "Tier1",
5296
+ });
5297
+
5298
+ /**
5299
+ * URL encoding strategy for link and image destinations.
5300
+ *
5301
+ * Controls how special characters in URL destinations are handled when they
5302
+ * require escaping to produce valid Markdown.
5303
+ *
5304
+ * The `Angle` variant (default) wraps the destination in angle brackets:
5305
+ * `[text](<url with spaces>)`. This is the CommonMark-specified escape hatch
5306
+ * but breaks when the URL itself contains `>`.
5307
+ *
5308
+ * The `Percent` variant percent-encodes every character that is not an RFC 3986
5309
+ * unreserved character or `/`, producing a destination safe for all Markdown
5310
+ * parsers: `[text](url%20with%20spaces)`.
5311
+ * @enum {0 | 1}
5312
+ */
5313
+ export const WasmUrlEscapeStyle = Object.freeze({
5314
+ Angle: 0, "0": "Angle",
5315
+ Percent: 1, "1": "Percent",
5316
+ });
5317
+
5184
5318
  /**
5185
5319
  * Result of a visitor callback.
5186
5320
  *
@@ -5265,7 +5399,12 @@ export const WasmWhitespaceMode = Object.freeze({
5265
5399
  * # Arguments
5266
5400
  *
5267
5401
  * * `html` — the HTML string to convert.
5268
- * * `options` — optional conversion options. Defaults to `ConversionOptions.default`.
5402
+ * * `options` — conversion options. The parameter bound is
5403
+ * `impl Into<Option<ConversionOptions>>`, so any of the following call shapes are accepted:
5404
+ * - `convert(html, ConversionOptions.default())` — bare options.
5405
+ * - `convert(html, opts)` — bare options.
5406
+ * - `convert(html, Some(opts))` — explicit `Option`.
5407
+ * - `convert(html, None)` — fall back to `ConversionOptions.default`.
5269
5408
  *
5270
5409
  * # Example
5271
5410
  *
@@ -59,7 +59,7 @@ export const wasmconversionoptions_listIndentType: (a: number, b: number) => voi
59
59
  export const wasmconversionoptions_listIndentWidth: (a: number) => number;
60
60
  export const wasmconversionoptions_maxDepth: (a: number) => number;
61
61
  export const wasmconversionoptions_maxImageSize: (a: number) => bigint;
62
- export const wasmconversionoptions_new: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number, n: number, o: number, p: number, q: number, r: number, s: number, t: number, u: number, v: number, w: number, x: number, y: number, z: number, a1: number, b1: number, c1: number, d1: number, e1: number, f1: number, g1: number, h1: number, i1: number, j1: number, k1: number, l1: number, m1: number, n1: number, o1: number, p1: number, q1: number, r1: number, s1: number, t1: number, u1: bigint, v1: number, w1: number, x1: number, y1: number, z1: number) => number;
62
+ export const wasmconversionoptions_new: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number, n: number, o: number, p: number, q: number, r: number, s: number, t: number, u: number, v: number, w: number, x: number, y: number, z: number, a1: number, b1: number, c1: number, d1: number, e1: number, f1: number, g1: number, h1: number, i1: number, j1: number, k1: number, l1: number, m1: number, n1: number, o1: number, p1: number, q1: number, r1: number, s1: number, t1: number, u1: number, v1: bigint, w1: number, x1: number, y1: number, z1: number, a2: number, b2: number) => number;
63
63
  export const wasmconversionoptions_newlineStyle: (a: number, b: number) => void;
64
64
  export const wasmconversionoptions_outputFormat: (a: number, b: number) => void;
65
65
  export const wasmconversionoptions_preprocessing: (a: number) => number;
@@ -102,6 +102,8 @@ export const wasmconversionoptions_set_stripTags: (a: number, b: number, c: numb
102
102
  export const wasmconversionoptions_set_strongEmSymbol: (a: number, b: number, c: number) => void;
103
103
  export const wasmconversionoptions_set_subSymbol: (a: number, b: number, c: number) => void;
104
104
  export const wasmconversionoptions_set_supSymbol: (a: number, b: number, c: number) => void;
105
+ export const wasmconversionoptions_set_tierStrategy: (a: number, b: number) => void;
106
+ export const wasmconversionoptions_set_urlEscapeStyle: (a: number, b: number) => void;
105
107
  export const wasmconversionoptions_set_visitor: (a: number, b: number) => void;
106
108
  export const wasmconversionoptions_set_whitespaceMode: (a: number, b: number) => void;
107
109
  export const wasmconversionoptions_set_wrap: (a: number, b: number) => void;
@@ -112,6 +114,8 @@ export const wasmconversionoptions_stripTags: (a: number, b: number) => void;
112
114
  export const wasmconversionoptions_strongEmSymbol: (a: number, b: number) => void;
113
115
  export const wasmconversionoptions_subSymbol: (a: number, b: number) => void;
114
116
  export const wasmconversionoptions_supSymbol: (a: number, b: number) => void;
117
+ export const wasmconversionoptions_tierStrategy: (a: number, b: number) => void;
118
+ export const wasmconversionoptions_urlEscapeStyle: (a: number, b: number) => void;
115
119
  export const wasmconversionoptions_visitor: (a: number) => number;
116
120
  export const wasmconversionoptions_whitespaceMode: (a: number, b: number) => void;
117
121
  export const wasmconversionoptions_wrap: (a: number) => number;
@@ -145,7 +149,7 @@ export const wasmconversionoptionsupdate_listIndentType: (a: number, b: number)
145
149
  export const wasmconversionoptionsupdate_listIndentWidth: (a: number) => number;
146
150
  export const wasmconversionoptionsupdate_maxDepth: (a: number) => number;
147
151
  export const wasmconversionoptionsupdate_maxImageSize: (a: number, b: number) => void;
148
- export const wasmconversionoptionsupdate_new: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number, n: number, o: number, p: number, q: number, r: number, s: number, t: number, u: number, v: number, w: number, x: number, y: number, z: number, a1: number, b1: number, c1: number, d1: number, e1: number, f1: number, g1: number, h1: number, i1: number, j1: number, k1: number, l1: number, m1: number, n1: number, o1: number, p1: number, q1: number, r1: number, s1: number, t1: number, u1: bigint, v1: number, w1: number, x1: number, y1: number, z1: number) => number;
152
+ export const wasmconversionoptionsupdate_new: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number, n: number, o: number, p: number, q: number, r: number, s: number, t: number, u: number, v: number, w: number, x: number, y: number, z: number, a1: number, b1: number, c1: number, d1: number, e1: number, f1: number, g1: number, h1: number, i1: number, j1: number, k1: number, l1: number, m1: number, n1: number, o1: number, p1: number, q1: number, r1: number, s1: number, t1: number, u1: number, v1: bigint, w1: number, x1: number, y1: number, z1: number, a2: number, b2: number) => number;
149
153
  export const wasmconversionoptionsupdate_newlineStyle: (a: number, b: number) => void;
150
154
  export const wasmconversionoptionsupdate_outputFormat: (a: number, b: number) => void;
151
155
  export const wasmconversionoptionsupdate_preprocessing: (a: number) => number;
@@ -188,6 +192,8 @@ export const wasmconversionoptionsupdate_set_stripTags: (a: number, b: number, c
188
192
  export const wasmconversionoptionsupdate_set_strongEmSymbol: (a: number, b: number, c: number) => void;
189
193
  export const wasmconversionoptionsupdate_set_subSymbol: (a: number, b: number, c: number) => void;
190
194
  export const wasmconversionoptionsupdate_set_supSymbol: (a: number, b: number, c: number) => void;
195
+ export const wasmconversionoptionsupdate_set_tierStrategy: (a: number, b: number) => void;
196
+ export const wasmconversionoptionsupdate_set_urlEscapeStyle: (a: number, b: number) => void;
191
197
  export const wasmconversionoptionsupdate_set_visitor: (a: number, b: number) => void;
192
198
  export const wasmconversionoptionsupdate_set_whitespaceMode: (a: number, b: number) => void;
193
199
  export const wasmconversionoptionsupdate_set_wrap: (a: number, b: number) => void;
@@ -198,6 +204,8 @@ export const wasmconversionoptionsupdate_stripTags: (a: number, b: number) => vo
198
204
  export const wasmconversionoptionsupdate_strongEmSymbol: (a: number, b: number) => void;
199
205
  export const wasmconversionoptionsupdate_subSymbol: (a: number, b: number) => void;
200
206
  export const wasmconversionoptionsupdate_supSymbol: (a: number, b: number) => void;
207
+ export const wasmconversionoptionsupdate_tierStrategy: (a: number, b: number) => void;
208
+ export const wasmconversionoptionsupdate_urlEscapeStyle: (a: number, b: number) => void;
201
209
  export const wasmconversionoptionsupdate_visitor: (a: number) => number;
202
210
  export const wasmconversionoptionsupdate_whitespaceMode: (a: number, b: number) => void;
203
211
  export const wasmconversionoptionsupdate_wrap: (a: number) => number;
@@ -2,7 +2,7 @@
2
2
  "name": "html-to-markdown-wasm",
3
3
  "type": "module",
4
4
  "description": "High-performance HTML to Markdown converter",
5
- "version": "3.5.5",
5
+ "version": "3.6.0-rc.2",
6
6
  "license": "MIT",
7
7
  "repository": {
8
8
  "type": "git",
@@ -126,6 +126,25 @@ const markdown = result.content;
126
126
  console.log(markdown);
127
127
  ```
128
128
 
129
+ ## Architecture
130
+
131
+ The converter routes each input through one of three tiers based on a fast prescan of the byte stream:
132
+
133
+ 1. **Tier-1 — single-pass byte scanner.** Handles 110+ HTML tags directly. Bails on any construct it cannot prove byte-equivalent to Tier-2.
134
+ 2. **Tier-2 — DOM walker.** Picks up Tier-1 bails and inputs the classifier rejected up front.
135
+ 3. **Tier-3 — standards-conformant parser.** Engaged for malformed HTML requiring full HTML5 repair.
136
+
137
+ The dispatcher is invisible to the caller. Output is byte-identical across tiers — enforced by a 116-snapshot oracle.
138
+
139
+ ## Capabilities
140
+
141
+ - **16 languages, one Rust core.** Rust, Python, Node.js, WASM, Java, Go, C#, PHP, Ruby, Elixir, R, Dart, Kotlin (Android), Swift, Zig, C ABI.
142
+ - **CommonMark-compatible Markdown** with GFM-style tables.
143
+ - **Djot output**: set `output_format = "djot"` (see Djot Output Format section below).
144
+ - **Real-HTML robust**: unclosed tags, CDATA, custom elements, malformed entities, nested tables, mixed encodings handled without losing content.
145
+ - **Metadata extraction**, **visitor API**, **inline images**, **configurable preprocessing presets**.
146
+ - **Per-group regression gates in CI**: every PR runs the bench harness against per-group thresholds.
147
+
129
148
  ## API Reference
130
149
 
131
150
  ### Core Function
@@ -40,7 +40,7 @@ export class WasmConversionOptions {
40
40
  free(): void;
41
41
  [Symbol.dispose](): void;
42
42
  static default(): WasmConversionOptions;
43
- constructor(headingStyle?: WasmHeadingStyle | null, listIndentType?: WasmListIndentType | null, listIndentWidth?: number | null, bullets?: string | null, strongEmSymbol?: string | null, escapeAsterisks?: boolean | null, escapeUnderscores?: boolean | null, escapeMisc?: boolean | null, escapeAscii?: boolean | null, codeLanguage?: string | null, autolinks?: boolean | null, defaultTitle?: boolean | null, brInTables?: boolean | null, compactTables?: boolean | null, highlightStyle?: WasmHighlightStyle | null, extractMetadata?: boolean | null, whitespaceMode?: WasmWhitespaceMode | null, stripNewlines?: boolean | null, wrap?: boolean | null, wrapWidth?: number | null, convertAsInline?: boolean | null, subSymbol?: string | null, supSymbol?: string | null, newlineStyle?: WasmNewlineStyle | null, codeBlockStyle?: WasmCodeBlockStyle | null, keepInlineImagesIn?: string[] | null, preprocessing?: WasmPreprocessingOptions | null, encoding?: string | null, debug?: boolean | null, stripTags?: string[] | null, preserveTags?: string[] | null, skipImages?: boolean | null, linkStyle?: WasmLinkStyle | null, outputFormat?: WasmOutputFormat | null, includeDocumentStructure?: boolean | null, extractImages?: boolean | null, maxImageSize?: bigint | null, captureSvg?: boolean | null, inferDimensions?: boolean | null, excludeSelectors?: string[] | null, maxDepth?: number | null);
43
+ constructor(headingStyle?: WasmHeadingStyle | null, listIndentType?: WasmListIndentType | null, listIndentWidth?: number | null, bullets?: string | null, strongEmSymbol?: string | null, escapeAsterisks?: boolean | null, escapeUnderscores?: boolean | null, escapeMisc?: boolean | null, escapeAscii?: boolean | null, codeLanguage?: string | null, autolinks?: boolean | null, defaultTitle?: boolean | null, brInTables?: boolean | null, compactTables?: boolean | null, highlightStyle?: WasmHighlightStyle | null, extractMetadata?: boolean | null, whitespaceMode?: WasmWhitespaceMode | null, stripNewlines?: boolean | null, wrap?: boolean | null, wrapWidth?: number | null, convertAsInline?: boolean | null, subSymbol?: string | null, supSymbol?: string | null, newlineStyle?: WasmNewlineStyle | null, codeBlockStyle?: WasmCodeBlockStyle | null, keepInlineImagesIn?: string[] | null, preprocessing?: WasmPreprocessingOptions | null, encoding?: string | null, debug?: boolean | null, stripTags?: string[] | null, preserveTags?: string[] | null, skipImages?: boolean | null, urlEscapeStyle?: WasmUrlEscapeStyle | null, linkStyle?: WasmLinkStyle | null, outputFormat?: WasmOutputFormat | null, includeDocumentStructure?: boolean | null, extractImages?: boolean | null, maxImageSize?: bigint | null, captureSvg?: boolean | null, inferDimensions?: boolean | null, excludeSelectors?: string[] | null, tierStrategy?: WasmTierStrategy | null, maxDepth?: number | null);
44
44
  autolinks: boolean;
45
45
  brInTables: boolean;
46
46
  bullets: string;
@@ -87,6 +87,10 @@ export class WasmConversionOptions {
87
87
  strongEmSymbol: string;
88
88
  subSymbol: string;
89
89
  supSymbol: string;
90
+ get tierStrategy(): string;
91
+ set tierStrategy(value: WasmTierStrategy);
92
+ get urlEscapeStyle(): string;
93
+ set urlEscapeStyle(value: WasmUrlEscapeStyle);
90
94
  get visitor(): WasmVisitorHandle | undefined;
91
95
  set visitor(value: WasmVisitorHandle | null | undefined);
92
96
  get whitespaceMode(): string;
@@ -105,7 +109,7 @@ export class WasmConversionOptionsUpdate {
105
109
  free(): void;
106
110
  [Symbol.dispose](): void;
107
111
  static default(): WasmConversionOptionsUpdate;
108
- constructor(headingStyle?: WasmHeadingStyle | null, listIndentType?: WasmListIndentType | null, listIndentWidth?: number | null, bullets?: string | null, strongEmSymbol?: string | null, escapeAsterisks?: boolean | null, escapeUnderscores?: boolean | null, escapeMisc?: boolean | null, escapeAscii?: boolean | null, codeLanguage?: string | null, autolinks?: boolean | null, defaultTitle?: boolean | null, brInTables?: boolean | null, compactTables?: boolean | null, highlightStyle?: WasmHighlightStyle | null, extractMetadata?: boolean | null, whitespaceMode?: WasmWhitespaceMode | null, stripNewlines?: boolean | null, wrap?: boolean | null, wrapWidth?: number | null, convertAsInline?: boolean | null, subSymbol?: string | null, supSymbol?: string | null, newlineStyle?: WasmNewlineStyle | null, codeBlockStyle?: WasmCodeBlockStyle | null, keepInlineImagesIn?: string[] | null, preprocessing?: WasmPreprocessingOptionsUpdate | null, encoding?: string | null, debug?: boolean | null, stripTags?: string[] | null, preserveTags?: string[] | null, skipImages?: boolean | null, linkStyle?: WasmLinkStyle | null, outputFormat?: WasmOutputFormat | null, includeDocumentStructure?: boolean | null, extractImages?: boolean | null, maxImageSize?: bigint | null, captureSvg?: boolean | null, inferDimensions?: boolean | null, maxDepth?: number | null, excludeSelectors?: string[] | null);
112
+ constructor(headingStyle?: WasmHeadingStyle | null, listIndentType?: WasmListIndentType | null, listIndentWidth?: number | null, bullets?: string | null, strongEmSymbol?: string | null, escapeAsterisks?: boolean | null, escapeUnderscores?: boolean | null, escapeMisc?: boolean | null, escapeAscii?: boolean | null, codeLanguage?: string | null, autolinks?: boolean | null, defaultTitle?: boolean | null, brInTables?: boolean | null, compactTables?: boolean | null, highlightStyle?: WasmHighlightStyle | null, extractMetadata?: boolean | null, whitespaceMode?: WasmWhitespaceMode | null, stripNewlines?: boolean | null, wrap?: boolean | null, wrapWidth?: number | null, convertAsInline?: boolean | null, subSymbol?: string | null, supSymbol?: string | null, newlineStyle?: WasmNewlineStyle | null, codeBlockStyle?: WasmCodeBlockStyle | null, keepInlineImagesIn?: string[] | null, preprocessing?: WasmPreprocessingOptionsUpdate | null, encoding?: string | null, debug?: boolean | null, stripTags?: string[] | null, preserveTags?: string[] | null, skipImages?: boolean | null, urlEscapeStyle?: WasmUrlEscapeStyle | null, linkStyle?: WasmLinkStyle | null, outputFormat?: WasmOutputFormat | null, includeDocumentStructure?: boolean | null, extractImages?: boolean | null, maxImageSize?: bigint | null, captureSvg?: boolean | null, inferDimensions?: boolean | null, maxDepth?: number | null, excludeSelectors?: string[] | null, tierStrategy?: WasmTierStrategy | null);
109
113
  get autolinks(): boolean | undefined;
110
114
  set autolinks(value: boolean | null | undefined);
111
115
  get brInTables(): boolean | undefined;
@@ -182,6 +186,10 @@ export class WasmConversionOptionsUpdate {
182
186
  set subSymbol(value: string | null | undefined);
183
187
  get supSymbol(): string | undefined;
184
188
  set supSymbol(value: string | null | undefined);
189
+ get tierStrategy(): string | undefined;
190
+ set tierStrategy(value: WasmTierStrategy | null | undefined);
191
+ get urlEscapeStyle(): string | undefined;
192
+ set urlEscapeStyle(value: WasmUrlEscapeStyle | null | undefined);
185
193
  get visitor(): WasmVisitorHandle | undefined;
186
194
  set visitor(value: WasmVisitorHandle | null | undefined);
187
195
  get whitespaceMode(): string | undefined;
@@ -826,6 +834,34 @@ export enum WasmTextDirection {
826
834
  Auto = 2,
827
835
  }
828
836
 
837
+ /**
838
+ * Controls which conversion tier is used.
839
+ */
840
+ export enum WasmTierStrategy {
841
+ Auto = 0,
842
+ Tier2 = 1,
843
+ Tier1 = 2,
844
+ }
845
+
846
+ /**
847
+ * URL encoding strategy for link and image destinations.
848
+ *
849
+ * Controls how special characters in URL destinations are handled when they
850
+ * require escaping to produce valid Markdown.
851
+ *
852
+ * The `Angle` variant (default) wraps the destination in angle brackets:
853
+ * `[text](<url with spaces>)`. This is the CommonMark-specified escape hatch
854
+ * but breaks when the URL itself contains `>`.
855
+ *
856
+ * The `Percent` variant percent-encodes every character that is not an RFC 3986
857
+ * unreserved character or `/`, producing a destination safe for all Markdown
858
+ * parsers: `[text](url%20with%20spaces)`.
859
+ */
860
+ export enum WasmUrlEscapeStyle {
861
+ Angle = 0,
862
+ Percent = 1,
863
+ }
864
+
829
865
  /**
830
866
  * Result of a visitor callback.
831
867
  *
@@ -884,7 +920,12 @@ export enum WasmWhitespaceMode {
884
920
  * # Arguments
885
921
  *
886
922
  * * `html` — the HTML string to convert.
887
- * * `options` — optional conversion options. Defaults to `ConversionOptions.default`.
923
+ * * `options` — conversion options. The parameter bound is
924
+ * `impl Into<Option<ConversionOptions>>`, so any of the following call shapes are accepted:
925
+ * - `convert(html, ConversionOptions.default())` — bare options.
926
+ * - `convert(html, opts)` — bare options.
927
+ * - `convert(html, Some(opts))` — explicit `Option`.
928
+ * - `convert(html, None)` — fall back to `ConversionOptions.default`.
888
929
  *
889
930
  * # Example
890
931
  *