@kreuzberg/html-to-markdown-wasm 3.4.0-rc.8 → 3.4.0

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.
@@ -63,7 +63,7 @@ export class WasmConversionOptions {
63
63
  * Create from a partial update, applying to defaults.
64
64
  */
65
65
  static fromUpdate(update: WasmConversionOptionsUpdate): WasmConversionOptions;
66
- constructor(heading_style?: WasmHeadingStyle | null, list_indent_type?: WasmListIndentType | null, list_indent_width?: number | null, bullets?: string | null, strong_em_symbol?: string | null, escape_asterisks?: boolean | null, escape_underscores?: boolean | null, escape_misc?: boolean | null, escape_ascii?: boolean | null, code_language?: string | null, autolinks?: boolean | null, default_title?: boolean | null, br_in_tables?: boolean | null, highlight_style?: WasmHighlightStyle | null, extract_metadata?: boolean | null, whitespace_mode?: WasmWhitespaceMode | null, strip_newlines?: boolean | null, wrap?: boolean | null, wrap_width?: number | null, convert_as_inline?: boolean | null, sub_symbol?: string | null, sup_symbol?: string | null, newline_style?: WasmNewlineStyle | null, code_block_style?: WasmCodeBlockStyle | null, keep_inline_images_in?: string[] | null, preprocessing?: WasmPreprocessingOptions | null, encoding?: string | null, debug?: boolean | null, strip_tags?: string[] | null, preserve_tags?: string[] | null, skip_images?: boolean | null, link_style?: WasmLinkStyle | null, output_format?: WasmOutputFormat | null, include_document_structure?: boolean | null, extract_images?: boolean | null, max_image_size?: bigint | null, capture_svg?: boolean | null, infer_dimensions?: boolean | null, exclude_selectors?: string[] | null, max_depth?: number | null);
66
+ constructor(heading_style?: WasmHeadingStyle | null, list_indent_type?: WasmListIndentType | null, list_indent_width?: number | null, bullets?: string | null, strong_em_symbol?: string | null, escape_asterisks?: boolean | null, escape_underscores?: boolean | null, escape_misc?: boolean | null, escape_ascii?: boolean | null, code_language?: string | null, autolinks?: boolean | null, default_title?: boolean | null, br_in_tables?: boolean | null, highlight_style?: WasmHighlightStyle | null, extract_metadata?: boolean | null, whitespace_mode?: WasmWhitespaceMode | null, strip_newlines?: boolean | null, wrap?: boolean | null, wrap_width?: number | null, convert_as_inline?: boolean | null, sub_symbol?: string | null, sup_symbol?: string | null, newline_style?: WasmNewlineStyle | null, code_block_style?: WasmCodeBlockStyle | null, keep_inline_images_in?: string[] | null, preprocessing?: WasmPreprocessingOptions | null, encoding?: string | null, debug?: boolean | null, strip_tags?: string[] | null, preserve_tags?: string[] | null, skip_images?: boolean | null, link_style?: WasmLinkStyle | null, output_format?: WasmOutputFormat | null, include_document_structure?: boolean | null, extract_images?: boolean | null, max_image_size?: bigint | null, capture_svg?: boolean | null, infer_dimensions?: boolean | null, exclude_selectors?: string[] | null, max_depth?: number | null, visitor?: WasmVisitorHandle | null);
67
67
  autolinks: boolean;
68
68
  brInTables: boolean;
69
69
  bullets: string;
@@ -102,6 +102,8 @@ export class WasmConversionOptions {
102
102
  strongEmSymbol: string;
103
103
  subSymbol: string;
104
104
  supSymbol: string;
105
+ get visitor(): WasmVisitorHandle | undefined;
106
+ set visitor(value: WasmVisitorHandle | null | undefined);
105
107
  whitespaceMode: WasmWhitespaceMode;
106
108
  wrap: boolean;
107
109
  wrapWidth: number;
@@ -140,6 +142,10 @@ export class WasmConversionOptionsBuilder {
140
142
  * Set the list of HTML tag names whose content is stripped from output.
141
143
  */
142
144
  stripTags(tags: string[]): WasmConversionOptionsBuilder;
145
+ /**
146
+ * Set the visitor used during conversion.
147
+ */
148
+ visitor(visitor?: WasmVisitorHandle | null): WasmConversionOptionsBuilder;
143
149
  }
144
150
 
145
151
  /**
@@ -151,7 +157,7 @@ export class WasmConversionOptionsBuilder {
151
157
  export class WasmConversionOptionsUpdate {
152
158
  free(): void;
153
159
  [Symbol.dispose](): void;
154
- constructor(heading_style?: WasmHeadingStyle | null, list_indent_type?: WasmListIndentType | null, list_indent_width?: number | null, bullets?: string | null, strong_em_symbol?: string | null, escape_asterisks?: boolean | null, escape_underscores?: boolean | null, escape_misc?: boolean | null, escape_ascii?: boolean | null, code_language?: string | null, autolinks?: boolean | null, default_title?: boolean | null, br_in_tables?: boolean | null, highlight_style?: WasmHighlightStyle | null, extract_metadata?: boolean | null, whitespace_mode?: WasmWhitespaceMode | null, strip_newlines?: boolean | null, wrap?: boolean | null, wrap_width?: number | null, convert_as_inline?: boolean | null, sub_symbol?: string | null, sup_symbol?: string | null, newline_style?: WasmNewlineStyle | null, code_block_style?: WasmCodeBlockStyle | null, keep_inline_images_in?: string[] | null, preprocessing?: WasmPreprocessingOptionsUpdate | null, encoding?: string | null, debug?: boolean | null, strip_tags?: string[] | null, preserve_tags?: string[] | null, skip_images?: boolean | null, link_style?: WasmLinkStyle | null, output_format?: WasmOutputFormat | null, include_document_structure?: boolean | null, extract_images?: boolean | null, max_image_size?: bigint | null, capture_svg?: boolean | null, infer_dimensions?: boolean | null, max_depth?: number | null, exclude_selectors?: string[] | null);
160
+ constructor(heading_style?: WasmHeadingStyle | null, list_indent_type?: WasmListIndentType | null, list_indent_width?: number | null, bullets?: string | null, strong_em_symbol?: string | null, escape_asterisks?: boolean | null, escape_underscores?: boolean | null, escape_misc?: boolean | null, escape_ascii?: boolean | null, code_language?: string | null, autolinks?: boolean | null, default_title?: boolean | null, br_in_tables?: boolean | null, highlight_style?: WasmHighlightStyle | null, extract_metadata?: boolean | null, whitespace_mode?: WasmWhitespaceMode | null, strip_newlines?: boolean | null, wrap?: boolean | null, wrap_width?: number | null, convert_as_inline?: boolean | null, sub_symbol?: string | null, sup_symbol?: string | null, newline_style?: WasmNewlineStyle | null, code_block_style?: WasmCodeBlockStyle | null, keep_inline_images_in?: string[] | null, preprocessing?: WasmPreprocessingOptionsUpdate | null, encoding?: string | null, debug?: boolean | null, strip_tags?: string[] | null, preserve_tags?: string[] | null, skip_images?: boolean | null, link_style?: WasmLinkStyle | null, output_format?: WasmOutputFormat | null, include_document_structure?: boolean | null, extract_images?: boolean | null, max_image_size?: bigint | null, capture_svg?: boolean | null, infer_dimensions?: boolean | null, max_depth?: number | null, exclude_selectors?: string[] | null, visitor?: WasmVisitorHandle | null);
155
161
  get autolinks(): boolean | undefined;
156
162
  set autolinks(value: boolean | null | undefined);
157
163
  get brInTables(): boolean | undefined;
@@ -226,6 +232,8 @@ export class WasmConversionOptionsUpdate {
226
232
  set subSymbol(value: string | null | undefined);
227
233
  get supSymbol(): string | undefined;
228
234
  set supSymbol(value: string | null | undefined);
235
+ get visitor(): WasmVisitorHandle | undefined;
236
+ set visitor(value: WasmVisitorHandle | null | undefined);
229
237
  get whitespaceMode(): WasmWhitespaceMode | undefined;
230
238
  set whitespaceMode(value: WasmWhitespaceMode | null | undefined);
231
239
  get wrap(): boolean | undefined;
@@ -273,7 +281,6 @@ export class WasmConversionResult {
273
281
  * # Examples
274
282
  *
275
283
  * ```
276
- * # use html_to_markdown_rs::metadata::DocumentMetadata;
277
284
  * let doc = DocumentMetadata {
278
285
  * title: Some("My Article".to_string()),
279
286
  * description: Some("A great article about Rust".to_string()),
@@ -363,7 +370,6 @@ export class WasmGridCell {
363
370
  * # Examples
364
371
  *
365
372
  * ```
366
- * # use html_to_markdown_rs::metadata::HeaderMetadata;
367
373
  * let header = HeaderMetadata {
368
374
  * level: 1,
369
375
  * text: "Main Title".to_string(),
@@ -389,7 +395,6 @@ export class WasmHeaderMetadata {
389
395
  * # Examples
390
396
  *
391
397
  * ```
392
- * # use html_to_markdown_rs::metadata::HeaderMetadata;
393
398
  * let valid = HeaderMetadata {
394
399
  * level: 3,
395
400
  * text: "Title".to_string(),
@@ -451,7 +456,6 @@ export enum WasmHighlightStyle {
451
456
  * # Examples
452
457
  *
453
458
  * ```
454
- * # use html_to_markdown_rs::metadata::HtmlMetadata;
455
459
  * let metadata = HtmlMetadata {
456
460
  * document: Default::default(),
457
461
  * headers: Vec::new(),
@@ -483,7 +487,6 @@ export class WasmHtmlMetadata {
483
487
  * # Examples
484
488
  *
485
489
  * ```
486
- * # use html_to_markdown_rs::metadata::{ImageMetadata, ImageType};
487
490
  * let img = ImageMetadata {
488
491
  * src: "https://example.com/image.jpg".to_string(),
489
492
  * alt: Some("An example image".to_string()),
@@ -531,7 +534,6 @@ export enum WasmImageType {
531
534
  * # Examples
532
535
  *
533
536
  * ```
534
- * # use html_to_markdown_rs::metadata::{LinkMetadata, LinkType};
535
537
  * let link = LinkMetadata {
536
538
  * href: "https://example.com".to_string(),
537
539
  * text: "Example".to_string(),
@@ -562,7 +564,6 @@ export class WasmLinkMetadata {
562
564
  * # Examples
563
565
  *
564
566
  * ```
565
- * # use html_to_markdown_rs::metadata::{LinkMetadata, LinkType};
566
567
  * assert_eq!(LinkMetadata::classify_link("#section"), LinkType::Anchor);
567
568
  * assert_eq!(LinkMetadata::classify_link("mailto:test@example.com"), LinkType::Email);
568
569
  * assert_eq!(LinkMetadata::classify_link("tel:+1234567890"), LinkType::Phone);
@@ -867,7 +868,6 @@ export class WasmProcessingWarning {
867
868
  * # Examples
868
869
  *
869
870
  * ```
870
- * # use html_to_markdown_rs::metadata::{StructuredData, StructuredDataType};
871
871
  * let schema = StructuredData {
872
872
  * data_type: StructuredDataType::JsonLd,
873
873
  * raw_json: r#"{"@context":"https://schema.org","@type":"Article"}"#.to_string(),
@@ -961,6 +961,17 @@ export enum WasmVisitResult {
961
961
  Error = 4,
962
962
  }
963
963
 
964
+ /**
965
+ * Type alias for a visitor handle (Rc-wrapped `RefCell` for interior mutability).
966
+ *
967
+ * This allows visitors to be passed around and shared while still being mutable.
968
+ */
969
+ export class WasmVisitorHandle {
970
+ free(): void;
971
+ [Symbol.dispose](): void;
972
+ constructor(visitor: any);
973
+ }
974
+
964
975
  /**
965
976
  * Categories of processing warnings.
966
977
  */
@@ -983,7 +994,30 @@ export enum WasmWhitespaceMode {
983
994
  Strict = 1,
984
995
  }
985
996
 
986
- export function convert(html: string, options?: WasmConversionOptions | null, visitor?: any | null): WasmConversionResult;
997
+ /**
998
+ * Convert HTML to Markdown, returning a [`ConversionResult`] with content, metadata, images,
999
+ * and warnings.
1000
+ *
1001
+ * # Arguments
1002
+ *
1003
+ * * `html` — the HTML string to convert.
1004
+ * * `options` — optional conversion options. Defaults to [`ConversionOptions::default`].
1005
+ *
1006
+ * # Example
1007
+ *
1008
+ * ```
1009
+ * use html_to_markdown_rs::convert;
1010
+ *
1011
+ * let html = "<h1>Hello World</h1>";
1012
+ * let result = convert(html, None).unwrap();
1013
+ * assert!(result.content.as_deref().unwrap_or("").contains("Hello World"));
1014
+ * ```
1015
+ *
1016
+ * # Errors
1017
+ *
1018
+ * Returns an error if HTML parsing fails or if the input contains invalid UTF-8.
1019
+ */
1020
+ export function convert(html: string, options?: WasmConversionOptions | null): WasmConversionResult;
987
1021
 
988
1022
  export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
989
1023
 
@@ -1008,7 +1042,8 @@ export interface InitOutput {
1008
1042
  readonly __wbg_wasmtabledata_free: (a: number, b: number) => void;
1009
1043
  readonly __wbg_wasmtablegrid_free: (a: number, b: number) => void;
1010
1044
  readonly __wbg_wasmtextannotation_free: (a: number, b: number) => void;
1011
- readonly convert: (a: number, b: number, c: number, d: number, e: number) => void;
1045
+ readonly __wbg_wasmvisitorhandle_free: (a: number, b: number) => void;
1046
+ readonly convert: (a: number, b: number, c: number, d: number) => void;
1012
1047
  readonly wasmconversionoptions_applyUpdate: (a: number, b: number) => void;
1013
1048
  readonly wasmconversionoptions_autolinks: (a: number) => number;
1014
1049
  readonly wasmconversionoptions_brInTables: (a: number) => number;
@@ -1041,7 +1076,7 @@ export interface InitOutput {
1041
1076
  readonly wasmconversionoptions_listIndentWidth: (a: number) => number;
1042
1077
  readonly wasmconversionoptions_maxDepth: (a: number) => number;
1043
1078
  readonly wasmconversionoptions_maxImageSize: (a: number) => bigint;
1044
- readonly 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: bigint, u1: number, v1: number, w1: number, x1: number, y1: number) => number;
1079
+ readonly 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: bigint, u1: number, v1: number, w1: number, x1: number, y1: number, z1: number) => number;
1045
1080
  readonly wasmconversionoptions_newlineStyle: (a: number) => number;
1046
1081
  readonly wasmconversionoptions_outputFormat: (a: number) => number;
1047
1082
  readonly wasmconversionoptions_preprocessing: (a: number) => number;
@@ -1083,6 +1118,7 @@ export interface InitOutput {
1083
1118
  readonly wasmconversionoptions_set_strongEmSymbol: (a: number, b: number, c: number) => void;
1084
1119
  readonly wasmconversionoptions_set_subSymbol: (a: number, b: number, c: number) => void;
1085
1120
  readonly wasmconversionoptions_set_supSymbol: (a: number, b: number, c: number) => void;
1121
+ readonly wasmconversionoptions_set_visitor: (a: number, b: number) => void;
1086
1122
  readonly wasmconversionoptions_set_whitespaceMode: (a: number, b: number) => void;
1087
1123
  readonly wasmconversionoptions_set_wrap: (a: number, b: number) => void;
1088
1124
  readonly wasmconversionoptions_set_wrapWidth: (a: number, b: number) => void;
@@ -1092,6 +1128,7 @@ export interface InitOutput {
1092
1128
  readonly wasmconversionoptions_strongEmSymbol: (a: number, b: number) => void;
1093
1129
  readonly wasmconversionoptions_subSymbol: (a: number, b: number) => void;
1094
1130
  readonly wasmconversionoptions_supSymbol: (a: number, b: number) => void;
1131
+ readonly wasmconversionoptions_visitor: (a: number) => number;
1095
1132
  readonly wasmconversionoptions_whitespaceMode: (a: number) => number;
1096
1133
  readonly wasmconversionoptions_wrap: (a: number) => number;
1097
1134
  readonly wasmconversionoptions_wrapWidth: (a: number) => number;
@@ -1101,6 +1138,7 @@ export interface InitOutput {
1101
1138
  readonly wasmconversionoptionsbuilder_preprocessing: (a: number, b: number) => number;
1102
1139
  readonly wasmconversionoptionsbuilder_preserveTags: (a: number, b: number, c: number) => number;
1103
1140
  readonly wasmconversionoptionsbuilder_stripTags: (a: number, b: number, c: number) => number;
1141
+ readonly wasmconversionoptionsbuilder_visitor: (a: number, b: number) => number;
1104
1142
  readonly wasmconversionoptionsupdate_autolinks: (a: number) => number;
1105
1143
  readonly wasmconversionoptionsupdate_brInTables: (a: number) => number;
1106
1144
  readonly wasmconversionoptionsupdate_bullets: (a: number, b: number) => void;
@@ -1128,7 +1166,7 @@ export interface InitOutput {
1128
1166
  readonly wasmconversionoptionsupdate_listIndentWidth: (a: number) => number;
1129
1167
  readonly wasmconversionoptionsupdate_maxDepth: (a: number) => number;
1130
1168
  readonly wasmconversionoptionsupdate_maxImageSize: (a: number, b: number) => void;
1131
- readonly 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: bigint, u1: number, v1: number, w1: number, x1: number, y1: number) => number;
1169
+ readonly 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: bigint, u1: number, v1: number, w1: number, x1: number, y1: number, z1: number) => number;
1132
1170
  readonly wasmconversionoptionsupdate_newlineStyle: (a: number) => number;
1133
1171
  readonly wasmconversionoptionsupdate_outputFormat: (a: number) => number;
1134
1172
  readonly wasmconversionoptionsupdate_preprocessing: (a: number) => number;
@@ -1170,6 +1208,7 @@ export interface InitOutput {
1170
1208
  readonly wasmconversionoptionsupdate_set_strongEmSymbol: (a: number, b: number, c: number) => void;
1171
1209
  readonly wasmconversionoptionsupdate_set_subSymbol: (a: number, b: number, c: number) => void;
1172
1210
  readonly wasmconversionoptionsupdate_set_supSymbol: (a: number, b: number, c: number) => void;
1211
+ readonly wasmconversionoptionsupdate_set_visitor: (a: number, b: number) => void;
1173
1212
  readonly wasmconversionoptionsupdate_set_whitespaceMode: (a: number, b: number) => void;
1174
1213
  readonly wasmconversionoptionsupdate_set_wrap: (a: number, b: number) => void;
1175
1214
  readonly wasmconversionoptionsupdate_set_wrapWidth: (a: number, b: number) => void;
@@ -1179,6 +1218,7 @@ export interface InitOutput {
1179
1218
  readonly wasmconversionoptionsupdate_strongEmSymbol: (a: number, b: number) => void;
1180
1219
  readonly wasmconversionoptionsupdate_subSymbol: (a: number, b: number) => void;
1181
1220
  readonly wasmconversionoptionsupdate_supSymbol: (a: number, b: number) => void;
1221
+ readonly wasmconversionoptionsupdate_visitor: (a: number) => number;
1182
1222
  readonly wasmconversionoptionsupdate_whitespaceMode: (a: number) => number;
1183
1223
  readonly wasmconversionoptionsupdate_wrap: (a: number) => number;
1184
1224
  readonly wasmconversionoptionsupdate_wrapWidth: (a: number) => number;
@@ -1358,6 +1398,7 @@ export interface InitOutput {
1358
1398
  readonly wasmtextannotation_set_kind: (a: number, b: number) => void;
1359
1399
  readonly wasmtextannotation_set_start: (a: number, b: number) => void;
1360
1400
  readonly wasmtextannotation_start: (a: number) => number;
1401
+ readonly wasmvisitorhandle_new: (a: number) => number;
1361
1402
  readonly wasmpreprocessingoptions_fromUpdate: (a: number) => number;
1362
1403
  readonly wasmheadermetadata_set_depth: (a: number, b: number) => void;
1363
1404
  readonly wasmnodecontext_set_depth: (a: number, b: number) => void;
@@ -1396,128 +1437,3 @@ export function initSync(module: { module: SyncInitInput } | SyncInitInput): Ini
1396
1437
  * @returns {Promise<InitOutput>}
1397
1438
  */
1398
1439
  export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
1399
-
1400
-
1401
- export type WasmHeadingStyle = "underlined" | "atx" | "atxClosed";
1402
- export type WasmListIndentType = "spaces" | "tabs";
1403
- export type WasmWhitespaceMode = "normalized" | "strict";
1404
- export type WasmNewlineStyle = "spaces" | "backslash";
1405
- export type WasmCodeBlockStyle = "indented" | "backticks" | "tildes";
1406
- export type WasmHighlightStyle = "doubleEqual" | "html" | "bold" | "none";
1407
- export type WasmPreprocessingPreset = "minimal" | "standard" | "aggressive";
1408
- export type WasmOutputFormat = "markdown" | "djot" | "plain";
1409
-
1410
- export interface WasmPreprocessingOptions {
1411
- enabled?: boolean;
1412
- preset?: WasmPreprocessingPreset;
1413
- removeNavigation?: boolean;
1414
- removeForms?: boolean;
1415
- }
1416
-
1417
- export interface WasmConversionOptions {
1418
- headingStyle?: WasmHeadingStyle;
1419
- listIndentType?: WasmListIndentType;
1420
- listIndentWidth?: number;
1421
- bullets?: string;
1422
- strongEmSymbol?: string;
1423
- escapeAsterisks?: boolean;
1424
- escapeUnderscores?: boolean;
1425
- escapeMisc?: boolean;
1426
- escapeAscii?: boolean;
1427
- codeLanguage?: string;
1428
- autolinks?: boolean;
1429
- defaultTitle?: boolean;
1430
- brInTables?: boolean;
1431
- hocrSpatialTables?: boolean;
1432
- highlightStyle?: WasmHighlightStyle;
1433
- extractMetadata?: boolean;
1434
- whitespaceMode?: WasmWhitespaceMode;
1435
- stripNewlines?: boolean;
1436
- wrap?: boolean;
1437
- wrapWidth?: number;
1438
- convertAsInline?: boolean;
1439
- subSymbol?: string;
1440
- supSymbol?: string;
1441
- newlineStyle?: WasmNewlineStyle;
1442
- codeBlockStyle?: WasmCodeBlockStyle;
1443
- keepInlineImagesIn?: string[];
1444
- preprocessing?: WasmPreprocessingOptions | null;
1445
- encoding?: string;
1446
- debug?: boolean;
1447
- stripTags?: string[];
1448
- preserveTags?: string[];
1449
- skipImages?: boolean;
1450
- outputFormat?: WasmOutputFormat;
1451
- includeDocumentStructure?: boolean;
1452
- extractImages?: boolean;
1453
- maxImageSize?: number;
1454
- captureSvg?: boolean;
1455
- inferDimensions?: boolean;
1456
- }
1457
-
1458
- /** A single cell in a structured table grid. */
1459
- export interface WasmGridCell {
1460
- content: string;
1461
- row: number;
1462
- col: number;
1463
- rowSpan: number;
1464
- colSpan: number;
1465
- isHeader: boolean;
1466
- }
1467
-
1468
- /** Structured table grid with cell-level data. */
1469
- export interface WasmTableGrid {
1470
- rows: number;
1471
- cols: number;
1472
- cells: WasmGridCell[];
1473
- }
1474
-
1475
- /** A table extracted during conversion. */
1476
- export interface WasmConversionTable {
1477
- grid: WasmTableGrid;
1478
- markdown: string;
1479
- }
1480
-
1481
- /** Non-fatal warning emitted during conversion. */
1482
- export interface WasmConversionWarning {
1483
- /** Human-readable warning message. */
1484
- message: string;
1485
- /** Warning kind identifier. */
1486
- kind: string;
1487
- }
1488
-
1489
- /** An extracted inline image from the HTML document. */
1490
- export interface WasmInlineImage {
1491
- /** Raw image data as a Uint8Array. */
1492
- data: Uint8Array;
1493
- /** Image format (png, jpeg, gif, svg, etc.). */
1494
- format: string;
1495
- /** Generated or provided filename, or null. */
1496
- filename: string | null;
1497
- /** Alt text or description, or null. */
1498
- description: string | null;
1499
- /** Image width in pixels, or null if not available. */
1500
- width: number | null;
1501
- /** Image height in pixels, or null if not available. */
1502
- height: number | null;
1503
- /** Source type ("img_data_uri" or "svg_element"). */
1504
- source: string;
1505
- /** HTML attributes from the source element. */
1506
- attributes: Record<string, string>;
1507
- }
1508
-
1509
- /** Result of the convert() API. */
1510
- export interface WasmConversionResult {
1511
- /** Converted text output (markdown, djot, or plain text), or null. */
1512
- content: string | null;
1513
- /** Structured document tree serialized as a JSON value, or null. */
1514
- document: unknown | null;
1515
- /** Extracted HTML metadata serialized as a JSON value, or null. */
1516
- metadata: unknown | null;
1517
- /** All tables found in the HTML, in document order. */
1518
- tables: WasmConversionTable[];
1519
- /** Extracted inline images (data URIs and SVGs). */
1520
- images: WasmInlineImage[];
1521
- /** Non-fatal processing warnings. */
1522
- warnings: WasmConversionWarning[];
1523
- }