@kreuzberg/html-to-markdown-wasm 3.2.4 → 3.3.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.
- package/dist/html_to_markdown_wasm.d.ts +539 -38
- package/dist/html_to_markdown_wasm_bg.js +826 -268
- package/dist/html_to_markdown_wasm_bg.wasm +0 -0
- package/dist/html_to_markdown_wasm_bg.wasm.d.ts +39 -37
- package/dist/package.json +6 -1
- package/dist-node/html_to_markdown_wasm.d.ts +539 -38
- package/dist-node/html_to_markdown_wasm.js +831 -272
- package/dist-node/html_to_markdown_wasm_bg.wasm +0 -0
- package/dist-node/html_to_markdown_wasm_bg.wasm.d.ts +39 -37
- package/dist-node/package.json +7 -2
- package/dist-web/html_to_markdown_wasm.d.ts +578 -75
- package/dist-web/html_to_markdown_wasm.js +826 -268
- package/dist-web/html_to_markdown_wasm_bg.wasm +0 -0
- package/dist-web/html_to_markdown_wasm_bg.wasm.d.ts +39 -37
- package/dist-web/package.json +6 -1
- package/package.json +2 -2
|
@@ -5,6 +5,9 @@
|
|
|
5
5
|
/* @ts-self-types="./html_to_markdown_wasm.d.ts" */
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
+
* The type of an inline text annotation.
|
|
9
|
+
*
|
|
10
|
+
* Uses internally tagged representation (`"annotation_type": "bold"`) for JSON serialization.
|
|
8
11
|
* @enum {0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8}
|
|
9
12
|
*/
|
|
10
13
|
const WasmAnnotationKind = Object.freeze({
|
|
@@ -21,6 +24,9 @@ const WasmAnnotationKind = Object.freeze({
|
|
|
21
24
|
exports.WasmAnnotationKind = WasmAnnotationKind;
|
|
22
25
|
|
|
23
26
|
/**
|
|
27
|
+
* Code block fence style in Markdown output.
|
|
28
|
+
*
|
|
29
|
+
* Determines how code blocks (`<pre><code>`) are rendered in Markdown.
|
|
24
30
|
* @enum {0 | 1 | 2}
|
|
25
31
|
*/
|
|
26
32
|
const WasmCodeBlockStyle = Object.freeze({
|
|
@@ -30,6 +36,23 @@ const WasmCodeBlockStyle = Object.freeze({
|
|
|
30
36
|
});
|
|
31
37
|
exports.WasmCodeBlockStyle = WasmCodeBlockStyle;
|
|
32
38
|
|
|
39
|
+
/**
|
|
40
|
+
* Main conversion options for HTML to Markdown conversion.
|
|
41
|
+
*
|
|
42
|
+
* Use [`ConversionOptions::builder()`] to construct, or [`Default::default()`] for defaults.
|
|
43
|
+
*
|
|
44
|
+
* # Example
|
|
45
|
+
*
|
|
46
|
+
* ```text
|
|
47
|
+
* use html_to_markdown_rs::ConversionOptions;
|
|
48
|
+
*
|
|
49
|
+
* let options = ConversionOptions::builder()
|
|
50
|
+
* .heading_style(HeadingStyle::Atx)
|
|
51
|
+
* .wrap(true)
|
|
52
|
+
* .wrap_width(100)
|
|
53
|
+
* .build();
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
33
56
|
class WasmConversionOptions {
|
|
34
57
|
static __wrap(ptr) {
|
|
35
58
|
ptr = ptr >>> 0;
|
|
@@ -48,6 +71,15 @@ class WasmConversionOptions {
|
|
|
48
71
|
const ptr = this.__destroy_into_raw();
|
|
49
72
|
wasm.__wbg_wasmconversionoptions_free(ptr, 0);
|
|
50
73
|
}
|
|
74
|
+
/**
|
|
75
|
+
* Apply a partial update to these conversion options.
|
|
76
|
+
* @param {WasmConversionOptionsUpdate} _update
|
|
77
|
+
*/
|
|
78
|
+
applyUpdate(_update) {
|
|
79
|
+
_assertClass(_update, WasmConversionOptionsUpdate);
|
|
80
|
+
var ptr0 = _update.__destroy_into_raw();
|
|
81
|
+
wasm.wasmconversionoptions_applyUpdate(this.__wbg_ptr, ptr0);
|
|
82
|
+
}
|
|
51
83
|
/**
|
|
52
84
|
* @returns {boolean}
|
|
53
85
|
*/
|
|
@@ -63,6 +95,7 @@ class WasmConversionOptions {
|
|
|
63
95
|
return ret !== 0;
|
|
64
96
|
}
|
|
65
97
|
/**
|
|
98
|
+
* Create a new builder with default values.
|
|
66
99
|
* @returns {WasmConversionOptionsBuilder}
|
|
67
100
|
*/
|
|
68
101
|
static builder() {
|
|
@@ -85,7 +118,7 @@ class WasmConversionOptions {
|
|
|
85
118
|
return getStringFromWasm0(r0, r1);
|
|
86
119
|
} finally {
|
|
87
120
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
88
|
-
wasm.
|
|
121
|
+
wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
|
|
89
122
|
}
|
|
90
123
|
}
|
|
91
124
|
/**
|
|
@@ -118,7 +151,7 @@ class WasmConversionOptions {
|
|
|
118
151
|
return getStringFromWasm0(r0, r1);
|
|
119
152
|
} finally {
|
|
120
153
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
121
|
-
wasm.
|
|
154
|
+
wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
|
|
122
155
|
}
|
|
123
156
|
}
|
|
124
157
|
/**
|
|
@@ -165,7 +198,7 @@ class WasmConversionOptions {
|
|
|
165
198
|
return getStringFromWasm0(r0, r1);
|
|
166
199
|
} finally {
|
|
167
200
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
168
|
-
wasm.
|
|
201
|
+
wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
|
|
169
202
|
}
|
|
170
203
|
}
|
|
171
204
|
/**
|
|
@@ -196,6 +229,22 @@ class WasmConversionOptions {
|
|
|
196
229
|
const ret = wasm.wasmconversionoptions_escapeUnderscores(this.__wbg_ptr);
|
|
197
230
|
return ret !== 0;
|
|
198
231
|
}
|
|
232
|
+
/**
|
|
233
|
+
* @returns {string[]}
|
|
234
|
+
*/
|
|
235
|
+
get excludeSelectors() {
|
|
236
|
+
try {
|
|
237
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
238
|
+
wasm.wasmconversionoptions_excludeSelectors(retptr, this.__wbg_ptr);
|
|
239
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
240
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
241
|
+
var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
|
|
242
|
+
wasm.__wbindgen_export4(r0, r1 * 4, 4);
|
|
243
|
+
return v1;
|
|
244
|
+
} finally {
|
|
245
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
199
248
|
/**
|
|
200
249
|
* @returns {boolean}
|
|
201
250
|
*/
|
|
@@ -210,6 +259,27 @@ class WasmConversionOptions {
|
|
|
210
259
|
const ret = wasm.wasmconversionoptions_extractMetadata(this.__wbg_ptr);
|
|
211
260
|
return ret !== 0;
|
|
212
261
|
}
|
|
262
|
+
/**
|
|
263
|
+
* @param {WasmConversionOptionsUpdate} update
|
|
264
|
+
* @returns {WasmConversionOptions}
|
|
265
|
+
*/
|
|
266
|
+
static from(update) {
|
|
267
|
+
_assertClass(update, WasmConversionOptionsUpdate);
|
|
268
|
+
var ptr0 = update.__destroy_into_raw();
|
|
269
|
+
const ret = wasm.wasmconversionoptions_from(ptr0);
|
|
270
|
+
return WasmConversionOptions.__wrap(ret);
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* Create from a partial update, applying to defaults.
|
|
274
|
+
* @param {WasmConversionOptionsUpdate} update
|
|
275
|
+
* @returns {WasmConversionOptions}
|
|
276
|
+
*/
|
|
277
|
+
static fromUpdate(update) {
|
|
278
|
+
_assertClass(update, WasmConversionOptionsUpdate);
|
|
279
|
+
var ptr0 = update.__destroy_into_raw();
|
|
280
|
+
const ret = wasm.wasmconversionoptions_fromUpdate(ptr0);
|
|
281
|
+
return WasmConversionOptions.__wrap(ret);
|
|
282
|
+
}
|
|
213
283
|
/**
|
|
214
284
|
* @returns {WasmHeadingStyle}
|
|
215
285
|
*/
|
|
@@ -248,7 +318,7 @@ class WasmConversionOptions {
|
|
|
248
318
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
249
319
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
250
320
|
var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
|
|
251
|
-
wasm.
|
|
321
|
+
wasm.__wbindgen_export4(r0, r1 * 4, 4);
|
|
252
322
|
return v1;
|
|
253
323
|
} finally {
|
|
254
324
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
@@ -275,6 +345,13 @@ class WasmConversionOptions {
|
|
|
275
345
|
const ret = wasm.wasmconversionoptions_listIndentWidth(this.__wbg_ptr);
|
|
276
346
|
return ret >>> 0;
|
|
277
347
|
}
|
|
348
|
+
/**
|
|
349
|
+
* @returns {number | undefined}
|
|
350
|
+
*/
|
|
351
|
+
get maxDepth() {
|
|
352
|
+
const ret = wasm.wasmconversionoptions_maxDepth(this.__wbg_ptr);
|
|
353
|
+
return ret === 0x100000001 ? undefined : ret;
|
|
354
|
+
}
|
|
278
355
|
/**
|
|
279
356
|
* @returns {bigint}
|
|
280
357
|
*/
|
|
@@ -321,8 +398,10 @@ class WasmConversionOptions {
|
|
|
321
398
|
* @param {bigint | null} [max_image_size]
|
|
322
399
|
* @param {boolean | null} [capture_svg]
|
|
323
400
|
* @param {boolean | null} [infer_dimensions]
|
|
401
|
+
* @param {string[] | null} [exclude_selectors]
|
|
402
|
+
* @param {number | null} [max_depth]
|
|
324
403
|
*/
|
|
325
|
-
constructor(heading_style, list_indent_type, list_indent_width, bullets, strong_em_symbol, escape_asterisks, escape_underscores, escape_misc, escape_ascii, code_language, autolinks, default_title, br_in_tables, highlight_style, extract_metadata, whitespace_mode, strip_newlines, wrap, wrap_width, convert_as_inline, sub_symbol, sup_symbol, newline_style, code_block_style, keep_inline_images_in, preprocessing, encoding, debug, strip_tags, preserve_tags, skip_images, link_style, output_format, include_document_structure, extract_images, max_image_size, capture_svg, infer_dimensions) {
|
|
404
|
+
constructor(heading_style, list_indent_type, list_indent_width, bullets, strong_em_symbol, escape_asterisks, escape_underscores, escape_misc, escape_ascii, code_language, autolinks, default_title, br_in_tables, highlight_style, extract_metadata, whitespace_mode, strip_newlines, wrap, wrap_width, convert_as_inline, sub_symbol, sup_symbol, newline_style, code_block_style, keep_inline_images_in, preprocessing, encoding, debug, strip_tags, preserve_tags, skip_images, link_style, output_format, include_document_structure, extract_images, max_image_size, capture_svg, infer_dimensions, exclude_selectors, max_depth) {
|
|
326
405
|
var ptr0 = isLikeNone(bullets) ? 0 : passStringToWasm0(bullets, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
327
406
|
var len0 = WASM_VECTOR_LEN;
|
|
328
407
|
var ptr1 = isLikeNone(strong_em_symbol) ? 0 : passStringToWasm0(strong_em_symbol, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
@@ -346,7 +425,9 @@ class WasmConversionOptions {
|
|
|
346
425
|
var len8 = WASM_VECTOR_LEN;
|
|
347
426
|
var ptr9 = isLikeNone(preserve_tags) ? 0 : passArrayJsValueToWasm0(preserve_tags, wasm.__wbindgen_export);
|
|
348
427
|
var len9 = WASM_VECTOR_LEN;
|
|
349
|
-
|
|
428
|
+
var ptr10 = isLikeNone(exclude_selectors) ? 0 : passArrayJsValueToWasm0(exclude_selectors, wasm.__wbindgen_export);
|
|
429
|
+
var len10 = WASM_VECTOR_LEN;
|
|
430
|
+
const ret = wasm.wasmconversionoptions_new(isLikeNone(heading_style) ? 3 : heading_style, isLikeNone(list_indent_type) ? 2 : list_indent_type, isLikeNone(list_indent_width) ? 0x100000001 : (list_indent_width) >>> 0, ptr0, len0, ptr1, len1, isLikeNone(escape_asterisks) ? 0xFFFFFF : escape_asterisks ? 1 : 0, isLikeNone(escape_underscores) ? 0xFFFFFF : escape_underscores ? 1 : 0, isLikeNone(escape_misc) ? 0xFFFFFF : escape_misc ? 1 : 0, isLikeNone(escape_ascii) ? 0xFFFFFF : escape_ascii ? 1 : 0, ptr2, len2, isLikeNone(autolinks) ? 0xFFFFFF : autolinks ? 1 : 0, isLikeNone(default_title) ? 0xFFFFFF : default_title ? 1 : 0, isLikeNone(br_in_tables) ? 0xFFFFFF : br_in_tables ? 1 : 0, isLikeNone(highlight_style) ? 4 : highlight_style, isLikeNone(extract_metadata) ? 0xFFFFFF : extract_metadata ? 1 : 0, isLikeNone(whitespace_mode) ? 2 : whitespace_mode, isLikeNone(strip_newlines) ? 0xFFFFFF : strip_newlines ? 1 : 0, isLikeNone(wrap) ? 0xFFFFFF : wrap ? 1 : 0, isLikeNone(wrap_width) ? 0x100000001 : (wrap_width) >>> 0, isLikeNone(convert_as_inline) ? 0xFFFFFF : convert_as_inline ? 1 : 0, ptr3, len3, ptr4, len4, isLikeNone(newline_style) ? 2 : newline_style, isLikeNone(code_block_style) ? 3 : code_block_style, ptr5, len5, ptr6, ptr7, len7, isLikeNone(debug) ? 0xFFFFFF : debug ? 1 : 0, ptr8, len8, ptr9, len9, isLikeNone(skip_images) ? 0xFFFFFF : skip_images ? 1 : 0, isLikeNone(link_style) ? 2 : link_style, isLikeNone(output_format) ? 3 : output_format, isLikeNone(include_document_structure) ? 0xFFFFFF : include_document_structure ? 1 : 0, isLikeNone(extract_images) ? 0xFFFFFF : extract_images ? 1 : 0, !isLikeNone(max_image_size), isLikeNone(max_image_size) ? BigInt(0) : max_image_size, isLikeNone(capture_svg) ? 0xFFFFFF : capture_svg ? 1 : 0, isLikeNone(infer_dimensions) ? 0xFFFFFF : infer_dimensions ? 1 : 0, ptr10, len10, isLikeNone(max_depth) ? 0x100000001 : (max_depth) >>> 0);
|
|
350
431
|
this.__wbg_ptr = ret >>> 0;
|
|
351
432
|
WasmConversionOptionsFinalization.register(this, this.__wbg_ptr, this);
|
|
352
433
|
return this;
|
|
@@ -382,7 +463,7 @@ class WasmConversionOptions {
|
|
|
382
463
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
383
464
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
384
465
|
var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
|
|
385
|
-
wasm.
|
|
466
|
+
wasm.__wbindgen_export4(r0, r1 * 4, 4);
|
|
386
467
|
return v1;
|
|
387
468
|
} finally {
|
|
388
469
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
@@ -478,6 +559,14 @@ class WasmConversionOptions {
|
|
|
478
559
|
set escapeUnderscores(value) {
|
|
479
560
|
wasm.wasmconversionoptions_set_escapeUnderscores(this.__wbg_ptr, value);
|
|
480
561
|
}
|
|
562
|
+
/**
|
|
563
|
+
* @param {string[]} value
|
|
564
|
+
*/
|
|
565
|
+
set excludeSelectors(value) {
|
|
566
|
+
const ptr0 = passArrayJsValueToWasm0(value, wasm.__wbindgen_export);
|
|
567
|
+
const len0 = WASM_VECTOR_LEN;
|
|
568
|
+
wasm.wasmconversionoptions_set_excludeSelectors(this.__wbg_ptr, ptr0, len0);
|
|
569
|
+
}
|
|
481
570
|
/**
|
|
482
571
|
* @param {boolean} value
|
|
483
572
|
*/
|
|
@@ -540,6 +629,12 @@ class WasmConversionOptions {
|
|
|
540
629
|
set listIndentWidth(value) {
|
|
541
630
|
wasm.wasmconversionoptions_set_listIndentWidth(this.__wbg_ptr, value);
|
|
542
631
|
}
|
|
632
|
+
/**
|
|
633
|
+
* @param {number | null} [value]
|
|
634
|
+
*/
|
|
635
|
+
set maxDepth(value) {
|
|
636
|
+
wasm.wasmconversionoptions_set_maxDepth(this.__wbg_ptr, isLikeNone(value) ? 0x100000001 : (value) >>> 0);
|
|
637
|
+
}
|
|
543
638
|
/**
|
|
544
639
|
* @param {bigint} value
|
|
545
640
|
*/
|
|
@@ -660,7 +755,7 @@ class WasmConversionOptions {
|
|
|
660
755
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
661
756
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
662
757
|
var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
|
|
663
|
-
wasm.
|
|
758
|
+
wasm.__wbindgen_export4(r0, r1 * 4, 4);
|
|
664
759
|
return v1;
|
|
665
760
|
} finally {
|
|
666
761
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
@@ -682,7 +777,7 @@ class WasmConversionOptions {
|
|
|
682
777
|
return getStringFromWasm0(r0, r1);
|
|
683
778
|
} finally {
|
|
684
779
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
685
|
-
wasm.
|
|
780
|
+
wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
|
|
686
781
|
}
|
|
687
782
|
}
|
|
688
783
|
/**
|
|
@@ -701,7 +796,7 @@ class WasmConversionOptions {
|
|
|
701
796
|
return getStringFromWasm0(r0, r1);
|
|
702
797
|
} finally {
|
|
703
798
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
704
|
-
wasm.
|
|
799
|
+
wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
|
|
705
800
|
}
|
|
706
801
|
}
|
|
707
802
|
/**
|
|
@@ -720,7 +815,7 @@ class WasmConversionOptions {
|
|
|
720
815
|
return getStringFromWasm0(r0, r1);
|
|
721
816
|
} finally {
|
|
722
817
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
723
|
-
wasm.
|
|
818
|
+
wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
|
|
724
819
|
}
|
|
725
820
|
}
|
|
726
821
|
/**
|
|
@@ -748,6 +843,11 @@ class WasmConversionOptions {
|
|
|
748
843
|
if (Symbol.dispose) WasmConversionOptions.prototype[Symbol.dispose] = WasmConversionOptions.prototype.free;
|
|
749
844
|
exports.WasmConversionOptions = WasmConversionOptions;
|
|
750
845
|
|
|
846
|
+
/**
|
|
847
|
+
* Builder for [`ConversionOptions`].
|
|
848
|
+
*
|
|
849
|
+
* All fields start with default values. Call `.build()` to produce the final options.
|
|
850
|
+
*/
|
|
751
851
|
class WasmConversionOptionsBuilder {
|
|
752
852
|
static __wrap(ptr) {
|
|
753
853
|
ptr = ptr >>> 0;
|
|
@@ -767,6 +867,7 @@ class WasmConversionOptionsBuilder {
|
|
|
767
867
|
wasm.__wbg_wasmconversionoptionsbuilder_free(ptr, 0);
|
|
768
868
|
}
|
|
769
869
|
/**
|
|
870
|
+
* Build the final [`ConversionOptions`].
|
|
770
871
|
* @returns {WasmConversionOptions}
|
|
771
872
|
*/
|
|
772
873
|
build() {
|
|
@@ -774,6 +875,18 @@ class WasmConversionOptionsBuilder {
|
|
|
774
875
|
return WasmConversionOptions.__wrap(ret);
|
|
775
876
|
}
|
|
776
877
|
/**
|
|
878
|
+
* Set the list of CSS selectors for elements to exclude entirely from output.
|
|
879
|
+
* @param {string[]} selectors
|
|
880
|
+
* @returns {WasmConversionOptionsBuilder}
|
|
881
|
+
*/
|
|
882
|
+
excludeSelectors(selectors) {
|
|
883
|
+
const ptr0 = passArrayJsValueToWasm0(selectors, wasm.__wbindgen_export);
|
|
884
|
+
const len0 = WASM_VECTOR_LEN;
|
|
885
|
+
const ret = wasm.wasmconversionoptionsbuilder_excludeSelectors(this.__wbg_ptr, ptr0, len0);
|
|
886
|
+
return WasmConversionOptionsBuilder.__wrap(ret);
|
|
887
|
+
}
|
|
888
|
+
/**
|
|
889
|
+
* Set the list of HTML tag names whose `<img>` children are kept inline.
|
|
777
890
|
* @param {string[]} tags
|
|
778
891
|
* @returns {WasmConversionOptionsBuilder}
|
|
779
892
|
*/
|
|
@@ -784,6 +897,7 @@ class WasmConversionOptionsBuilder {
|
|
|
784
897
|
return WasmConversionOptionsBuilder.__wrap(ret);
|
|
785
898
|
}
|
|
786
899
|
/**
|
|
900
|
+
* Set the pre-processing options applied to the HTML before conversion.
|
|
787
901
|
* @param {WasmPreprocessingOptions} preprocessing
|
|
788
902
|
* @returns {WasmConversionOptionsBuilder}
|
|
789
903
|
*/
|
|
@@ -794,6 +908,7 @@ class WasmConversionOptionsBuilder {
|
|
|
794
908
|
return WasmConversionOptionsBuilder.__wrap(ret);
|
|
795
909
|
}
|
|
796
910
|
/**
|
|
911
|
+
* Set the list of HTML tag names that are preserved verbatim in output.
|
|
797
912
|
* @param {string[]} tags
|
|
798
913
|
* @returns {WasmConversionOptionsBuilder}
|
|
799
914
|
*/
|
|
@@ -804,6 +919,7 @@ class WasmConversionOptionsBuilder {
|
|
|
804
919
|
return WasmConversionOptionsBuilder.__wrap(ret);
|
|
805
920
|
}
|
|
806
921
|
/**
|
|
922
|
+
* Set the list of HTML tag names whose content is stripped from output.
|
|
807
923
|
* @param {string[]} tags
|
|
808
924
|
* @returns {WasmConversionOptionsBuilder}
|
|
809
925
|
*/
|
|
@@ -817,6 +933,12 @@ class WasmConversionOptionsBuilder {
|
|
|
817
933
|
if (Symbol.dispose) WasmConversionOptionsBuilder.prototype[Symbol.dispose] = WasmConversionOptionsBuilder.prototype.free;
|
|
818
934
|
exports.WasmConversionOptionsBuilder = WasmConversionOptionsBuilder;
|
|
819
935
|
|
|
936
|
+
/**
|
|
937
|
+
* Partial update for `ConversionOptions`.
|
|
938
|
+
*
|
|
939
|
+
* Uses `Option<T>` fields for selective updates. Bindings use this to construct
|
|
940
|
+
* options from language-native types. Prefer [`ConversionOptionsBuilder`] for Rust code.
|
|
941
|
+
*/
|
|
820
942
|
class WasmConversionOptionsUpdate {
|
|
821
943
|
__destroy_into_raw() {
|
|
822
944
|
const ptr = this.__wbg_ptr;
|
|
@@ -854,7 +976,7 @@ class WasmConversionOptionsUpdate {
|
|
|
854
976
|
let v1;
|
|
855
977
|
if (r0 !== 0) {
|
|
856
978
|
v1 = getStringFromWasm0(r0, r1).slice();
|
|
857
|
-
wasm.
|
|
979
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
858
980
|
}
|
|
859
981
|
return v1;
|
|
860
982
|
} finally {
|
|
@@ -887,7 +1009,7 @@ class WasmConversionOptionsUpdate {
|
|
|
887
1009
|
let v1;
|
|
888
1010
|
if (r0 !== 0) {
|
|
889
1011
|
v1 = getStringFromWasm0(r0, r1).slice();
|
|
890
|
-
wasm.
|
|
1012
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
891
1013
|
}
|
|
892
1014
|
return v1;
|
|
893
1015
|
} finally {
|
|
@@ -927,7 +1049,7 @@ class WasmConversionOptionsUpdate {
|
|
|
927
1049
|
let v1;
|
|
928
1050
|
if (r0 !== 0) {
|
|
929
1051
|
v1 = getStringFromWasm0(r0, r1).slice();
|
|
930
|
-
wasm.
|
|
1052
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
931
1053
|
}
|
|
932
1054
|
return v1;
|
|
933
1055
|
} finally {
|
|
@@ -962,6 +1084,25 @@ class WasmConversionOptionsUpdate {
|
|
|
962
1084
|
const ret = wasm.wasmconversionoptionsupdate_escapeUnderscores(this.__wbg_ptr);
|
|
963
1085
|
return ret === 0xFFFFFF ? undefined : ret !== 0;
|
|
964
1086
|
}
|
|
1087
|
+
/**
|
|
1088
|
+
* @returns {string[] | undefined}
|
|
1089
|
+
*/
|
|
1090
|
+
get excludeSelectors() {
|
|
1091
|
+
try {
|
|
1092
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1093
|
+
wasm.wasmconversionoptionsupdate_excludeSelectors(retptr, this.__wbg_ptr);
|
|
1094
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1095
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1096
|
+
let v1;
|
|
1097
|
+
if (r0 !== 0) {
|
|
1098
|
+
v1 = getArrayJsValueFromWasm0(r0, r1).slice();
|
|
1099
|
+
wasm.__wbindgen_export4(r0, r1 * 4, 4);
|
|
1100
|
+
}
|
|
1101
|
+
return v1;
|
|
1102
|
+
} finally {
|
|
1103
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1104
|
+
}
|
|
1105
|
+
}
|
|
965
1106
|
/**
|
|
966
1107
|
* @returns {boolean | undefined}
|
|
967
1108
|
*/
|
|
@@ -1016,7 +1157,7 @@ class WasmConversionOptionsUpdate {
|
|
|
1016
1157
|
let v1;
|
|
1017
1158
|
if (r0 !== 0) {
|
|
1018
1159
|
v1 = getArrayJsValueFromWasm0(r0, r1).slice();
|
|
1019
|
-
wasm.
|
|
1160
|
+
wasm.__wbindgen_export4(r0, r1 * 4, 4);
|
|
1020
1161
|
}
|
|
1021
1162
|
return v1;
|
|
1022
1163
|
} finally {
|
|
@@ -1044,6 +1185,13 @@ class WasmConversionOptionsUpdate {
|
|
|
1044
1185
|
const ret = wasm.wasmconversionoptionsupdate_listIndentWidth(this.__wbg_ptr);
|
|
1045
1186
|
return ret === 0x100000001 ? undefined : ret;
|
|
1046
1187
|
}
|
|
1188
|
+
/**
|
|
1189
|
+
* @returns {number | undefined}
|
|
1190
|
+
*/
|
|
1191
|
+
get maxDepth() {
|
|
1192
|
+
const ret = wasm.wasmconversionoptionsupdate_maxDepth(this.__wbg_ptr);
|
|
1193
|
+
return ret === 0x100000001 ? undefined : ret;
|
|
1194
|
+
}
|
|
1047
1195
|
/**
|
|
1048
1196
|
* @returns {bigint | undefined}
|
|
1049
1197
|
*/
|
|
@@ -1097,8 +1245,10 @@ class WasmConversionOptionsUpdate {
|
|
|
1097
1245
|
* @param {bigint | null} [max_image_size]
|
|
1098
1246
|
* @param {boolean | null} [capture_svg]
|
|
1099
1247
|
* @param {boolean | null} [infer_dimensions]
|
|
1248
|
+
* @param {number | null} [max_depth]
|
|
1249
|
+
* @param {string[] | null} [exclude_selectors]
|
|
1100
1250
|
*/
|
|
1101
|
-
constructor(heading_style, list_indent_type, list_indent_width, bullets, strong_em_symbol, escape_asterisks, escape_underscores, escape_misc, escape_ascii, code_language, autolinks, default_title, br_in_tables, highlight_style, extract_metadata, whitespace_mode, strip_newlines, wrap, wrap_width, convert_as_inline, sub_symbol, sup_symbol, newline_style, code_block_style, keep_inline_images_in, preprocessing, encoding, debug, strip_tags, preserve_tags, skip_images, link_style, output_format, include_document_structure, extract_images, max_image_size, capture_svg, infer_dimensions) {
|
|
1251
|
+
constructor(heading_style, list_indent_type, list_indent_width, bullets, strong_em_symbol, escape_asterisks, escape_underscores, escape_misc, escape_ascii, code_language, autolinks, default_title, br_in_tables, highlight_style, extract_metadata, whitespace_mode, strip_newlines, wrap, wrap_width, convert_as_inline, sub_symbol, sup_symbol, newline_style, code_block_style, keep_inline_images_in, preprocessing, encoding, debug, strip_tags, preserve_tags, skip_images, link_style, output_format, include_document_structure, extract_images, max_image_size, capture_svg, infer_dimensions, max_depth, exclude_selectors) {
|
|
1102
1252
|
var ptr0 = isLikeNone(bullets) ? 0 : passStringToWasm0(bullets, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1103
1253
|
var len0 = WASM_VECTOR_LEN;
|
|
1104
1254
|
var ptr1 = isLikeNone(strong_em_symbol) ? 0 : passStringToWasm0(strong_em_symbol, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
@@ -1122,7 +1272,9 @@ class WasmConversionOptionsUpdate {
|
|
|
1122
1272
|
var len8 = WASM_VECTOR_LEN;
|
|
1123
1273
|
var ptr9 = isLikeNone(preserve_tags) ? 0 : passArrayJsValueToWasm0(preserve_tags, wasm.__wbindgen_export);
|
|
1124
1274
|
var len9 = WASM_VECTOR_LEN;
|
|
1125
|
-
|
|
1275
|
+
var ptr10 = isLikeNone(exclude_selectors) ? 0 : passArrayJsValueToWasm0(exclude_selectors, wasm.__wbindgen_export);
|
|
1276
|
+
var len10 = WASM_VECTOR_LEN;
|
|
1277
|
+
const ret = wasm.wasmconversionoptionsupdate_new(isLikeNone(heading_style) ? 3 : heading_style, isLikeNone(list_indent_type) ? 2 : list_indent_type, isLikeNone(list_indent_width) ? 0x100000001 : (list_indent_width) >>> 0, ptr0, len0, ptr1, len1, isLikeNone(escape_asterisks) ? 0xFFFFFF : escape_asterisks ? 1 : 0, isLikeNone(escape_underscores) ? 0xFFFFFF : escape_underscores ? 1 : 0, isLikeNone(escape_misc) ? 0xFFFFFF : escape_misc ? 1 : 0, isLikeNone(escape_ascii) ? 0xFFFFFF : escape_ascii ? 1 : 0, ptr2, len2, isLikeNone(autolinks) ? 0xFFFFFF : autolinks ? 1 : 0, isLikeNone(default_title) ? 0xFFFFFF : default_title ? 1 : 0, isLikeNone(br_in_tables) ? 0xFFFFFF : br_in_tables ? 1 : 0, isLikeNone(highlight_style) ? 4 : highlight_style, isLikeNone(extract_metadata) ? 0xFFFFFF : extract_metadata ? 1 : 0, isLikeNone(whitespace_mode) ? 2 : whitespace_mode, isLikeNone(strip_newlines) ? 0xFFFFFF : strip_newlines ? 1 : 0, isLikeNone(wrap) ? 0xFFFFFF : wrap ? 1 : 0, isLikeNone(wrap_width) ? 0x100000001 : (wrap_width) >>> 0, isLikeNone(convert_as_inline) ? 0xFFFFFF : convert_as_inline ? 1 : 0, ptr3, len3, ptr4, len4, isLikeNone(newline_style) ? 2 : newline_style, isLikeNone(code_block_style) ? 3 : code_block_style, ptr5, len5, ptr6, ptr7, len7, isLikeNone(debug) ? 0xFFFFFF : debug ? 1 : 0, ptr8, len8, ptr9, len9, isLikeNone(skip_images) ? 0xFFFFFF : skip_images ? 1 : 0, isLikeNone(link_style) ? 2 : link_style, isLikeNone(output_format) ? 3 : output_format, isLikeNone(include_document_structure) ? 0xFFFFFF : include_document_structure ? 1 : 0, isLikeNone(extract_images) ? 0xFFFFFF : extract_images ? 1 : 0, !isLikeNone(max_image_size), isLikeNone(max_image_size) ? BigInt(0) : max_image_size, isLikeNone(capture_svg) ? 0xFFFFFF : capture_svg ? 1 : 0, isLikeNone(infer_dimensions) ? 0xFFFFFF : infer_dimensions ? 1 : 0, isLikeNone(max_depth) ? 0x100000001 : (max_depth) >>> 0, ptr10, len10);
|
|
1126
1278
|
this.__wbg_ptr = ret >>> 0;
|
|
1127
1279
|
WasmConversionOptionsUpdateFinalization.register(this, this.__wbg_ptr, this);
|
|
1128
1280
|
return this;
|
|
@@ -1160,7 +1312,7 @@ class WasmConversionOptionsUpdate {
|
|
|
1160
1312
|
let v1;
|
|
1161
1313
|
if (r0 !== 0) {
|
|
1162
1314
|
v1 = getArrayJsValueFromWasm0(r0, r1).slice();
|
|
1163
|
-
wasm.
|
|
1315
|
+
wasm.__wbindgen_export4(r0, r1 * 4, 4);
|
|
1164
1316
|
}
|
|
1165
1317
|
return v1;
|
|
1166
1318
|
} finally {
|
|
@@ -1257,6 +1409,14 @@ class WasmConversionOptionsUpdate {
|
|
|
1257
1409
|
set escapeUnderscores(value) {
|
|
1258
1410
|
wasm.wasmconversionoptionsupdate_set_escapeUnderscores(this.__wbg_ptr, isLikeNone(value) ? 0xFFFFFF : value ? 1 : 0);
|
|
1259
1411
|
}
|
|
1412
|
+
/**
|
|
1413
|
+
* @param {string[] | null} [value]
|
|
1414
|
+
*/
|
|
1415
|
+
set excludeSelectors(value) {
|
|
1416
|
+
var ptr0 = isLikeNone(value) ? 0 : passArrayJsValueToWasm0(value, wasm.__wbindgen_export);
|
|
1417
|
+
var len0 = WASM_VECTOR_LEN;
|
|
1418
|
+
wasm.wasmconversionoptionsupdate_set_excludeSelectors(this.__wbg_ptr, ptr0, len0);
|
|
1419
|
+
}
|
|
1260
1420
|
/**
|
|
1261
1421
|
* @param {boolean | null} [value]
|
|
1262
1422
|
*/
|
|
@@ -1319,6 +1479,12 @@ class WasmConversionOptionsUpdate {
|
|
|
1319
1479
|
set listIndentWidth(value) {
|
|
1320
1480
|
wasm.wasmconversionoptionsupdate_set_listIndentWidth(this.__wbg_ptr, isLikeNone(value) ? 0x100000001 : (value) >>> 0);
|
|
1321
1481
|
}
|
|
1482
|
+
/**
|
|
1483
|
+
* @param {number | null} [value]
|
|
1484
|
+
*/
|
|
1485
|
+
set maxDepth(value) {
|
|
1486
|
+
wasm.wasmconversionoptionsupdate_set_maxDepth(this.__wbg_ptr, isLikeNone(value) ? 0x100000001 : (value) >>> 0);
|
|
1487
|
+
}
|
|
1322
1488
|
/**
|
|
1323
1489
|
* @param {bigint | null} [value]
|
|
1324
1490
|
*/
|
|
@@ -1444,7 +1610,7 @@ class WasmConversionOptionsUpdate {
|
|
|
1444
1610
|
let v1;
|
|
1445
1611
|
if (r0 !== 0) {
|
|
1446
1612
|
v1 = getArrayJsValueFromWasm0(r0, r1).slice();
|
|
1447
|
-
wasm.
|
|
1613
|
+
wasm.__wbindgen_export4(r0, r1 * 4, 4);
|
|
1448
1614
|
}
|
|
1449
1615
|
return v1;
|
|
1450
1616
|
} finally {
|
|
@@ -1463,7 +1629,7 @@ class WasmConversionOptionsUpdate {
|
|
|
1463
1629
|
let v1;
|
|
1464
1630
|
if (r0 !== 0) {
|
|
1465
1631
|
v1 = getStringFromWasm0(r0, r1).slice();
|
|
1466
|
-
wasm.
|
|
1632
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
1467
1633
|
}
|
|
1468
1634
|
return v1;
|
|
1469
1635
|
} finally {
|
|
@@ -1482,7 +1648,7 @@ class WasmConversionOptionsUpdate {
|
|
|
1482
1648
|
let v1;
|
|
1483
1649
|
if (r0 !== 0) {
|
|
1484
1650
|
v1 = getStringFromWasm0(r0, r1).slice();
|
|
1485
|
-
wasm.
|
|
1651
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
1486
1652
|
}
|
|
1487
1653
|
return v1;
|
|
1488
1654
|
} finally {
|
|
@@ -1501,7 +1667,7 @@ class WasmConversionOptionsUpdate {
|
|
|
1501
1667
|
let v1;
|
|
1502
1668
|
if (r0 !== 0) {
|
|
1503
1669
|
v1 = getStringFromWasm0(r0, r1).slice();
|
|
1504
|
-
wasm.
|
|
1670
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
1505
1671
|
}
|
|
1506
1672
|
return v1;
|
|
1507
1673
|
} finally {
|
|
@@ -1533,6 +1699,22 @@ class WasmConversionOptionsUpdate {
|
|
|
1533
1699
|
if (Symbol.dispose) WasmConversionOptionsUpdate.prototype[Symbol.dispose] = WasmConversionOptionsUpdate.prototype.free;
|
|
1534
1700
|
exports.WasmConversionOptionsUpdate = WasmConversionOptionsUpdate;
|
|
1535
1701
|
|
|
1702
|
+
/**
|
|
1703
|
+
* The primary result of HTML conversion and extraction.
|
|
1704
|
+
*
|
|
1705
|
+
* Contains the converted text output, optional structured document tree,
|
|
1706
|
+
* metadata, extracted tables, images, and processing warnings.
|
|
1707
|
+
*
|
|
1708
|
+
* # Example
|
|
1709
|
+
*
|
|
1710
|
+
* ```text
|
|
1711
|
+
* use html_to_markdown_rs::{convert, ConversionOptions};
|
|
1712
|
+
*
|
|
1713
|
+
* let result = convert("<h1>Hello</h1><p>World</p>", None)?;
|
|
1714
|
+
* assert!(result.content.is_some());
|
|
1715
|
+
* assert!(result.warnings.is_empty());
|
|
1716
|
+
* ```
|
|
1717
|
+
*/
|
|
1536
1718
|
class WasmConversionResult {
|
|
1537
1719
|
static __wrap(ptr) {
|
|
1538
1720
|
ptr = ptr >>> 0;
|
|
@@ -1563,7 +1745,7 @@ class WasmConversionResult {
|
|
|
1563
1745
|
let v1;
|
|
1564
1746
|
if (r0 !== 0) {
|
|
1565
1747
|
v1 = getStringFromWasm0(r0, r1).slice();
|
|
1566
|
-
wasm.
|
|
1748
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
1567
1749
|
}
|
|
1568
1750
|
return v1;
|
|
1569
1751
|
} finally {
|
|
@@ -1587,7 +1769,7 @@ class WasmConversionResult {
|
|
|
1587
1769
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1588
1770
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1589
1771
|
var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
|
|
1590
|
-
wasm.
|
|
1772
|
+
wasm.__wbindgen_export4(r0, r1 * 4, 4);
|
|
1591
1773
|
return v1;
|
|
1592
1774
|
} finally {
|
|
1593
1775
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
@@ -1693,7 +1875,7 @@ class WasmConversionResult {
|
|
|
1693
1875
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1694
1876
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1695
1877
|
var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
|
|
1696
|
-
wasm.
|
|
1878
|
+
wasm.__wbindgen_export4(r0, r1 * 4, 4);
|
|
1697
1879
|
return v1;
|
|
1698
1880
|
} finally {
|
|
1699
1881
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
@@ -1709,7 +1891,7 @@ class WasmConversionResult {
|
|
|
1709
1891
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1710
1892
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1711
1893
|
var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
|
|
1712
|
-
wasm.
|
|
1894
|
+
wasm.__wbindgen_export4(r0, r1 * 4, 4);
|
|
1713
1895
|
return v1;
|
|
1714
1896
|
} finally {
|
|
1715
1897
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
@@ -1719,6 +1901,26 @@ class WasmConversionResult {
|
|
|
1719
1901
|
if (Symbol.dispose) WasmConversionResult.prototype[Symbol.dispose] = WasmConversionResult.prototype.free;
|
|
1720
1902
|
exports.WasmConversionResult = WasmConversionResult;
|
|
1721
1903
|
|
|
1904
|
+
/**
|
|
1905
|
+
* Document-level metadata extracted from `<head>` and top-level elements.
|
|
1906
|
+
*
|
|
1907
|
+
* Contains all metadata typically used by search engines, social media platforms,
|
|
1908
|
+
* and browsers for document indexing and presentation.
|
|
1909
|
+
*
|
|
1910
|
+
* # Examples
|
|
1911
|
+
*
|
|
1912
|
+
* ```
|
|
1913
|
+
* # use html_to_markdown_rs::metadata::DocumentMetadata;
|
|
1914
|
+
* let doc = DocumentMetadata {
|
|
1915
|
+
* title: Some("My Article".to_string()),
|
|
1916
|
+
* description: Some("A great article about Rust".to_string()),
|
|
1917
|
+
* keywords: vec!["rust".to_string(), "programming".to_string()],
|
|
1918
|
+
* ..Default::default()
|
|
1919
|
+
* };
|
|
1920
|
+
*
|
|
1921
|
+
* assert_eq!(doc.title, Some("My Article".to_string()));
|
|
1922
|
+
* ```
|
|
1923
|
+
*/
|
|
1722
1924
|
class WasmDocumentMetadata {
|
|
1723
1925
|
static __wrap(ptr) {
|
|
1724
1926
|
ptr = ptr >>> 0;
|
|
@@ -1749,7 +1951,7 @@ class WasmDocumentMetadata {
|
|
|
1749
1951
|
let v1;
|
|
1750
1952
|
if (r0 !== 0) {
|
|
1751
1953
|
v1 = getStringFromWasm0(r0, r1).slice();
|
|
1752
|
-
wasm.
|
|
1954
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
1753
1955
|
}
|
|
1754
1956
|
return v1;
|
|
1755
1957
|
} finally {
|
|
@@ -1768,7 +1970,7 @@ class WasmDocumentMetadata {
|
|
|
1768
1970
|
let v1;
|
|
1769
1971
|
if (r0 !== 0) {
|
|
1770
1972
|
v1 = getStringFromWasm0(r0, r1).slice();
|
|
1771
|
-
wasm.
|
|
1973
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
1772
1974
|
}
|
|
1773
1975
|
return v1;
|
|
1774
1976
|
} finally {
|
|
@@ -1787,7 +1989,7 @@ class WasmDocumentMetadata {
|
|
|
1787
1989
|
let v1;
|
|
1788
1990
|
if (r0 !== 0) {
|
|
1789
1991
|
v1 = getStringFromWasm0(r0, r1).slice();
|
|
1790
|
-
wasm.
|
|
1992
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
1791
1993
|
}
|
|
1792
1994
|
return v1;
|
|
1793
1995
|
} finally {
|
|
@@ -1806,7 +2008,7 @@ class WasmDocumentMetadata {
|
|
|
1806
2008
|
let v1;
|
|
1807
2009
|
if (r0 !== 0) {
|
|
1808
2010
|
v1 = getStringFromWasm0(r0, r1).slice();
|
|
1809
|
-
wasm.
|
|
2011
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
1810
2012
|
}
|
|
1811
2013
|
return v1;
|
|
1812
2014
|
} finally {
|
|
@@ -1823,7 +2025,7 @@ class WasmDocumentMetadata {
|
|
|
1823
2025
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1824
2026
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1825
2027
|
var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
|
|
1826
|
-
wasm.
|
|
2028
|
+
wasm.__wbindgen_export4(r0, r1 * 4, 4);
|
|
1827
2029
|
return v1;
|
|
1828
2030
|
} finally {
|
|
1829
2031
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
@@ -1841,7 +2043,7 @@ class WasmDocumentMetadata {
|
|
|
1841
2043
|
let v1;
|
|
1842
2044
|
if (r0 !== 0) {
|
|
1843
2045
|
v1 = getStringFromWasm0(r0, r1).slice();
|
|
1844
|
-
wasm.
|
|
2046
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
1845
2047
|
}
|
|
1846
2048
|
return v1;
|
|
1847
2049
|
} finally {
|
|
@@ -1994,7 +2196,7 @@ class WasmDocumentMetadata {
|
|
|
1994
2196
|
let v1;
|
|
1995
2197
|
if (r0 !== 0) {
|
|
1996
2198
|
v1 = getStringFromWasm0(r0, r1).slice();
|
|
1997
|
-
wasm.
|
|
2199
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
1998
2200
|
}
|
|
1999
2201
|
return v1;
|
|
2000
2202
|
} finally {
|
|
@@ -2012,6 +2214,9 @@ class WasmDocumentMetadata {
|
|
|
2012
2214
|
if (Symbol.dispose) WasmDocumentMetadata.prototype[Symbol.dispose] = WasmDocumentMetadata.prototype.free;
|
|
2013
2215
|
exports.WasmDocumentMetadata = WasmDocumentMetadata;
|
|
2014
2216
|
|
|
2217
|
+
/**
|
|
2218
|
+
* A single node in the document tree.
|
|
2219
|
+
*/
|
|
2015
2220
|
class WasmDocumentNode {
|
|
2016
2221
|
static __wrap(ptr) {
|
|
2017
2222
|
ptr = ptr >>> 0;
|
|
@@ -2046,7 +2251,7 @@ class WasmDocumentNode {
|
|
|
2046
2251
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
2047
2252
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
2048
2253
|
var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
|
|
2049
|
-
wasm.
|
|
2254
|
+
wasm.__wbindgen_export4(r0, r1 * 4, 4);
|
|
2050
2255
|
return v1;
|
|
2051
2256
|
} finally {
|
|
2052
2257
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
@@ -2069,7 +2274,7 @@ class WasmDocumentNode {
|
|
|
2069
2274
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
2070
2275
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
2071
2276
|
var v1 = getArrayU32FromWasm0(r0, r1).slice();
|
|
2072
|
-
wasm.
|
|
2277
|
+
wasm.__wbindgen_export4(r0, r1 * 4, 4);
|
|
2073
2278
|
return v1;
|
|
2074
2279
|
} finally {
|
|
2075
2280
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
@@ -2098,7 +2303,7 @@ class WasmDocumentNode {
|
|
|
2098
2303
|
return getStringFromWasm0(r0, r1);
|
|
2099
2304
|
} finally {
|
|
2100
2305
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
2101
|
-
wasm.
|
|
2306
|
+
wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
|
|
2102
2307
|
}
|
|
2103
2308
|
}
|
|
2104
2309
|
/**
|
|
@@ -2174,6 +2379,11 @@ class WasmDocumentNode {
|
|
|
2174
2379
|
if (Symbol.dispose) WasmDocumentNode.prototype[Symbol.dispose] = WasmDocumentNode.prototype.free;
|
|
2175
2380
|
exports.WasmDocumentNode = WasmDocumentNode;
|
|
2176
2381
|
|
|
2382
|
+
/**
|
|
2383
|
+
* A structured document tree representing the semantic content of an HTML document.
|
|
2384
|
+
*
|
|
2385
|
+
* Uses a flat node array with index-based parent/child references for efficient traversal.
|
|
2386
|
+
*/
|
|
2177
2387
|
class WasmDocumentStructure {
|
|
2178
2388
|
static __wrap(ptr) {
|
|
2179
2389
|
ptr = ptr >>> 0;
|
|
@@ -2216,7 +2426,7 @@ class WasmDocumentStructure {
|
|
|
2216
2426
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
2217
2427
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
2218
2428
|
var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
|
|
2219
|
-
wasm.
|
|
2429
|
+
wasm.__wbindgen_export4(r0, r1 * 4, 4);
|
|
2220
2430
|
return v1;
|
|
2221
2431
|
} finally {
|
|
2222
2432
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
@@ -2250,7 +2460,7 @@ class WasmDocumentStructure {
|
|
|
2250
2460
|
let v1;
|
|
2251
2461
|
if (r0 !== 0) {
|
|
2252
2462
|
v1 = getStringFromWasm0(r0, r1).slice();
|
|
2253
|
-
wasm.
|
|
2463
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
2254
2464
|
}
|
|
2255
2465
|
return v1;
|
|
2256
2466
|
} finally {
|
|
@@ -2261,6 +2471,9 @@ class WasmDocumentStructure {
|
|
|
2261
2471
|
if (Symbol.dispose) WasmDocumentStructure.prototype[Symbol.dispose] = WasmDocumentStructure.prototype.free;
|
|
2262
2472
|
exports.WasmDocumentStructure = WasmDocumentStructure;
|
|
2263
2473
|
|
|
2474
|
+
/**
|
|
2475
|
+
* A single cell in a table grid.
|
|
2476
|
+
*/
|
|
2264
2477
|
class WasmGridCell {
|
|
2265
2478
|
static __wrap(ptr) {
|
|
2266
2479
|
ptr = ptr >>> 0;
|
|
@@ -2315,7 +2528,7 @@ class WasmGridCell {
|
|
|
2315
2528
|
return getStringFromWasm0(r0, r1);
|
|
2316
2529
|
} finally {
|
|
2317
2530
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
2318
|
-
wasm.
|
|
2531
|
+
wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
|
|
2319
2532
|
}
|
|
2320
2533
|
}
|
|
2321
2534
|
/**
|
|
@@ -2397,6 +2610,28 @@ class WasmGridCell {
|
|
|
2397
2610
|
if (Symbol.dispose) WasmGridCell.prototype[Symbol.dispose] = WasmGridCell.prototype.free;
|
|
2398
2611
|
exports.WasmGridCell = WasmGridCell;
|
|
2399
2612
|
|
|
2613
|
+
/**
|
|
2614
|
+
* Header element metadata with hierarchy tracking.
|
|
2615
|
+
*
|
|
2616
|
+
* Captures heading elements (h1-h6) with their text content, identifiers,
|
|
2617
|
+
* and position in the document structure.
|
|
2618
|
+
*
|
|
2619
|
+
* # Examples
|
|
2620
|
+
*
|
|
2621
|
+
* ```
|
|
2622
|
+
* # use html_to_markdown_rs::metadata::HeaderMetadata;
|
|
2623
|
+
* let header = HeaderMetadata {
|
|
2624
|
+
* level: 1,
|
|
2625
|
+
* text: "Main Title".to_string(),
|
|
2626
|
+
* id: Some("main-title".to_string()),
|
|
2627
|
+
* depth: 0,
|
|
2628
|
+
* html_offset: 145,
|
|
2629
|
+
* };
|
|
2630
|
+
*
|
|
2631
|
+
* assert_eq!(header.level, 1);
|
|
2632
|
+
* assert!(header.is_valid());
|
|
2633
|
+
* ```
|
|
2634
|
+
*/
|
|
2400
2635
|
class WasmHeaderMetadata {
|
|
2401
2636
|
static __wrap(ptr) {
|
|
2402
2637
|
ptr = ptr >>> 0;
|
|
@@ -2447,7 +2682,7 @@ class WasmHeaderMetadata {
|
|
|
2447
2682
|
let v1;
|
|
2448
2683
|
if (r0 !== 0) {
|
|
2449
2684
|
v1 = getStringFromWasm0(r0, r1).slice();
|
|
2450
|
-
wasm.
|
|
2685
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
2451
2686
|
}
|
|
2452
2687
|
return v1;
|
|
2453
2688
|
} finally {
|
|
@@ -2455,6 +2690,34 @@ class WasmHeaderMetadata {
|
|
|
2455
2690
|
}
|
|
2456
2691
|
}
|
|
2457
2692
|
/**
|
|
2693
|
+
* Validate that the header level is within valid range (1-6).
|
|
2694
|
+
*
|
|
2695
|
+
* # Returns
|
|
2696
|
+
*
|
|
2697
|
+
* `true` if level is 1-6, `false` otherwise.
|
|
2698
|
+
*
|
|
2699
|
+
* # Examples
|
|
2700
|
+
*
|
|
2701
|
+
* ```
|
|
2702
|
+
* # use html_to_markdown_rs::metadata::HeaderMetadata;
|
|
2703
|
+
* let valid = HeaderMetadata {
|
|
2704
|
+
* level: 3,
|
|
2705
|
+
* text: "Title".to_string(),
|
|
2706
|
+
* id: None,
|
|
2707
|
+
* depth: 2,
|
|
2708
|
+
* html_offset: 100,
|
|
2709
|
+
* };
|
|
2710
|
+
* assert!(valid.is_valid());
|
|
2711
|
+
*
|
|
2712
|
+
* let invalid = HeaderMetadata {
|
|
2713
|
+
* level: 7, // Invalid
|
|
2714
|
+
* text: "Title".to_string(),
|
|
2715
|
+
* id: None,
|
|
2716
|
+
* depth: 2,
|
|
2717
|
+
* html_offset: 100,
|
|
2718
|
+
* };
|
|
2719
|
+
* assert!(!invalid.is_valid());
|
|
2720
|
+
* ```
|
|
2458
2721
|
* @returns {boolean}
|
|
2459
2722
|
*/
|
|
2460
2723
|
isValid() {
|
|
@@ -2535,7 +2798,7 @@ class WasmHeaderMetadata {
|
|
|
2535
2798
|
return getStringFromWasm0(r0, r1);
|
|
2536
2799
|
} finally {
|
|
2537
2800
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
2538
|
-
wasm.
|
|
2801
|
+
wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
|
|
2539
2802
|
}
|
|
2540
2803
|
}
|
|
2541
2804
|
}
|
|
@@ -2543,6 +2806,9 @@ if (Symbol.dispose) WasmHeaderMetadata.prototype[Symbol.dispose] = WasmHeaderMet
|
|
|
2543
2806
|
exports.WasmHeaderMetadata = WasmHeaderMetadata;
|
|
2544
2807
|
|
|
2545
2808
|
/**
|
|
2809
|
+
* Heading style options for Markdown output.
|
|
2810
|
+
*
|
|
2811
|
+
* Controls how headings (h1-h6) are rendered in the output Markdown.
|
|
2546
2812
|
* @enum {0 | 1 | 2}
|
|
2547
2813
|
*/
|
|
2548
2814
|
const WasmHeadingStyle = Object.freeze({
|
|
@@ -2553,6 +2819,9 @@ const WasmHeadingStyle = Object.freeze({
|
|
|
2553
2819
|
exports.WasmHeadingStyle = WasmHeadingStyle;
|
|
2554
2820
|
|
|
2555
2821
|
/**
|
|
2822
|
+
* Highlight rendering style for `<mark>` elements.
|
|
2823
|
+
*
|
|
2824
|
+
* Controls how highlighted text is rendered in Markdown output.
|
|
2556
2825
|
* @enum {0 | 1 | 2 | 3}
|
|
2557
2826
|
*/
|
|
2558
2827
|
const WasmHighlightStyle = Object.freeze({
|
|
@@ -2563,6 +2832,27 @@ const WasmHighlightStyle = Object.freeze({
|
|
|
2563
2832
|
});
|
|
2564
2833
|
exports.WasmHighlightStyle = WasmHighlightStyle;
|
|
2565
2834
|
|
|
2835
|
+
/**
|
|
2836
|
+
* Comprehensive metadata extraction result from HTML document.
|
|
2837
|
+
*
|
|
2838
|
+
* Contains all extracted metadata types in a single structure,
|
|
2839
|
+
* suitable for serialization and transmission across language boundaries.
|
|
2840
|
+
*
|
|
2841
|
+
* # Examples
|
|
2842
|
+
*
|
|
2843
|
+
* ```
|
|
2844
|
+
* # use html_to_markdown_rs::metadata::HtmlMetadata;
|
|
2845
|
+
* let metadata = HtmlMetadata {
|
|
2846
|
+
* document: Default::default(),
|
|
2847
|
+
* headers: Vec::new(),
|
|
2848
|
+
* links: Vec::new(),
|
|
2849
|
+
* images: Vec::new(),
|
|
2850
|
+
* structured_data: Vec::new(),
|
|
2851
|
+
* };
|
|
2852
|
+
*
|
|
2853
|
+
* assert!(metadata.headers.is_empty());
|
|
2854
|
+
* ```
|
|
2855
|
+
*/
|
|
2566
2856
|
class WasmHtmlMetadata {
|
|
2567
2857
|
static __wrap(ptr) {
|
|
2568
2858
|
ptr = ptr >>> 0;
|
|
@@ -2598,7 +2888,7 @@ class WasmHtmlMetadata {
|
|
|
2598
2888
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
2599
2889
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
2600
2890
|
var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
|
|
2601
|
-
wasm.
|
|
2891
|
+
wasm.__wbindgen_export4(r0, r1 * 4, 4);
|
|
2602
2892
|
return v1;
|
|
2603
2893
|
} finally {
|
|
2604
2894
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
@@ -2614,7 +2904,7 @@ class WasmHtmlMetadata {
|
|
|
2614
2904
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
2615
2905
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
2616
2906
|
var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
|
|
2617
|
-
wasm.
|
|
2907
|
+
wasm.__wbindgen_export4(r0, r1 * 4, 4);
|
|
2618
2908
|
return v1;
|
|
2619
2909
|
} finally {
|
|
2620
2910
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
@@ -2630,7 +2920,7 @@ class WasmHtmlMetadata {
|
|
|
2630
2920
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
2631
2921
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
2632
2922
|
var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
|
|
2633
|
-
wasm.
|
|
2923
|
+
wasm.__wbindgen_export4(r0, r1 * 4, 4);
|
|
2634
2924
|
return v1;
|
|
2635
2925
|
} finally {
|
|
2636
2926
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
@@ -2712,7 +3002,7 @@ class WasmHtmlMetadata {
|
|
|
2712
3002
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
2713
3003
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
2714
3004
|
var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
|
|
2715
|
-
wasm.
|
|
3005
|
+
wasm.__wbindgen_export4(r0, r1 * 4, 4);
|
|
2716
3006
|
return v1;
|
|
2717
3007
|
} finally {
|
|
2718
3008
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
@@ -2722,6 +3012,28 @@ class WasmHtmlMetadata {
|
|
|
2722
3012
|
if (Symbol.dispose) WasmHtmlMetadata.prototype[Symbol.dispose] = WasmHtmlMetadata.prototype.free;
|
|
2723
3013
|
exports.WasmHtmlMetadata = WasmHtmlMetadata;
|
|
2724
3014
|
|
|
3015
|
+
/**
|
|
3016
|
+
* Image metadata with source and dimensions.
|
|
3017
|
+
*
|
|
3018
|
+
* Captures `<img>` elements and inline `<svg>` elements with metadata
|
|
3019
|
+
* for image analysis and optimization.
|
|
3020
|
+
*
|
|
3021
|
+
* # Examples
|
|
3022
|
+
*
|
|
3023
|
+
* ```
|
|
3024
|
+
* # use html_to_markdown_rs::metadata::{ImageMetadata, ImageType};
|
|
3025
|
+
* let img = ImageMetadata {
|
|
3026
|
+
* src: "https://example.com/image.jpg".to_string(),
|
|
3027
|
+
* alt: Some("An example image".to_string()),
|
|
3028
|
+
* title: Some("Example".to_string()),
|
|
3029
|
+
* dimensions: Some((800, 600)),
|
|
3030
|
+
* image_type: ImageType::External,
|
|
3031
|
+
* attributes: Default::default(),
|
|
3032
|
+
* };
|
|
3033
|
+
*
|
|
3034
|
+
* assert_eq!(img.image_type, ImageType::External);
|
|
3035
|
+
* ```
|
|
3036
|
+
*/
|
|
2725
3037
|
class WasmImageMetadata {
|
|
2726
3038
|
static __wrap(ptr) {
|
|
2727
3039
|
ptr = ptr >>> 0;
|
|
@@ -2758,7 +3070,7 @@ class WasmImageMetadata {
|
|
|
2758
3070
|
let v1;
|
|
2759
3071
|
if (r0 !== 0) {
|
|
2760
3072
|
v1 = getStringFromWasm0(r0, r1).slice();
|
|
2761
|
-
wasm.
|
|
3073
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
2762
3074
|
}
|
|
2763
3075
|
return v1;
|
|
2764
3076
|
} finally {
|
|
@@ -2773,7 +3085,7 @@ class WasmImageMetadata {
|
|
|
2773
3085
|
return takeObject(ret);
|
|
2774
3086
|
}
|
|
2775
3087
|
/**
|
|
2776
|
-
* @returns {
|
|
3088
|
+
* @returns {Uint32Array | undefined}
|
|
2777
3089
|
*/
|
|
2778
3090
|
get dimensions() {
|
|
2779
3091
|
try {
|
|
@@ -2783,8 +3095,8 @@ class WasmImageMetadata {
|
|
|
2783
3095
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
2784
3096
|
let v1;
|
|
2785
3097
|
if (r0 !== 0) {
|
|
2786
|
-
v1 =
|
|
2787
|
-
wasm.
|
|
3098
|
+
v1 = getArrayU32FromWasm0(r0, r1).slice();
|
|
3099
|
+
wasm.__wbindgen_export4(r0, r1 * 4, 4);
|
|
2788
3100
|
}
|
|
2789
3101
|
return v1;
|
|
2790
3102
|
} finally {
|
|
@@ -2804,7 +3116,7 @@ class WasmImageMetadata {
|
|
|
2804
3116
|
* @param {any} attributes
|
|
2805
3117
|
* @param {string | null} [alt]
|
|
2806
3118
|
* @param {string | null} [title]
|
|
2807
|
-
* @param {
|
|
3119
|
+
* @param {Uint32Array | null} [dimensions]
|
|
2808
3120
|
*/
|
|
2809
3121
|
constructor(src, image_type, attributes, alt, title, dimensions) {
|
|
2810
3122
|
const ptr0 = passStringToWasm0(src, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
@@ -2813,7 +3125,7 @@ class WasmImageMetadata {
|
|
|
2813
3125
|
var len1 = WASM_VECTOR_LEN;
|
|
2814
3126
|
var ptr2 = isLikeNone(title) ? 0 : passStringToWasm0(title, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
2815
3127
|
var len2 = WASM_VECTOR_LEN;
|
|
2816
|
-
var ptr3 = isLikeNone(dimensions) ? 0 :
|
|
3128
|
+
var ptr3 = isLikeNone(dimensions) ? 0 : passArray32ToWasm0(dimensions, wasm.__wbindgen_export);
|
|
2817
3129
|
var len3 = WASM_VECTOR_LEN;
|
|
2818
3130
|
const ret = wasm.wasmimagemetadata_new(ptr0, len0, image_type, addHeapObject(attributes), ptr1, len1, ptr2, len2, ptr3, len3);
|
|
2819
3131
|
this.__wbg_ptr = ret >>> 0;
|
|
@@ -2835,10 +3147,10 @@ class WasmImageMetadata {
|
|
|
2835
3147
|
wasm.wasmimagemetadata_set_attributes(this.__wbg_ptr, addHeapObject(value));
|
|
2836
3148
|
}
|
|
2837
3149
|
/**
|
|
2838
|
-
* @param {
|
|
3150
|
+
* @param {Uint32Array | null} [value]
|
|
2839
3151
|
*/
|
|
2840
3152
|
set dimensions(value) {
|
|
2841
|
-
var ptr0 = isLikeNone(value) ? 0 :
|
|
3153
|
+
var ptr0 = isLikeNone(value) ? 0 : passArray32ToWasm0(value, wasm.__wbindgen_export);
|
|
2842
3154
|
var len0 = WASM_VECTOR_LEN;
|
|
2843
3155
|
wasm.wasmimagemetadata_set_dimensions(this.__wbg_ptr, ptr0, len0);
|
|
2844
3156
|
}
|
|
@@ -2880,7 +3192,7 @@ class WasmImageMetadata {
|
|
|
2880
3192
|
return getStringFromWasm0(r0, r1);
|
|
2881
3193
|
} finally {
|
|
2882
3194
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
2883
|
-
wasm.
|
|
3195
|
+
wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
|
|
2884
3196
|
}
|
|
2885
3197
|
}
|
|
2886
3198
|
/**
|
|
@@ -2895,7 +3207,7 @@ class WasmImageMetadata {
|
|
|
2895
3207
|
let v1;
|
|
2896
3208
|
if (r0 !== 0) {
|
|
2897
3209
|
v1 = getStringFromWasm0(r0, r1).slice();
|
|
2898
|
-
wasm.
|
|
3210
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
2899
3211
|
}
|
|
2900
3212
|
return v1;
|
|
2901
3213
|
} finally {
|
|
@@ -2907,6 +3219,9 @@ if (Symbol.dispose) WasmImageMetadata.prototype[Symbol.dispose] = WasmImageMetad
|
|
|
2907
3219
|
exports.WasmImageMetadata = WasmImageMetadata;
|
|
2908
3220
|
|
|
2909
3221
|
/**
|
|
3222
|
+
* Image source classification for proper handling and processing.
|
|
3223
|
+
*
|
|
3224
|
+
* Determines whether an image is embedded (data URI), inline SVG, external, or relative.
|
|
2910
3225
|
* @enum {0 | 1 | 2 | 3}
|
|
2911
3226
|
*/
|
|
2912
3227
|
const WasmImageType = Object.freeze({
|
|
@@ -2917,6 +3232,28 @@ const WasmImageType = Object.freeze({
|
|
|
2917
3232
|
});
|
|
2918
3233
|
exports.WasmImageType = WasmImageType;
|
|
2919
3234
|
|
|
3235
|
+
/**
|
|
3236
|
+
* Hyperlink metadata with categorization and attributes.
|
|
3237
|
+
*
|
|
3238
|
+
* Represents `<a>` elements with parsed href values, text content, and link type classification.
|
|
3239
|
+
*
|
|
3240
|
+
* # Examples
|
|
3241
|
+
*
|
|
3242
|
+
* ```
|
|
3243
|
+
* # use html_to_markdown_rs::metadata::{LinkMetadata, LinkType};
|
|
3244
|
+
* let link = LinkMetadata {
|
|
3245
|
+
* href: "https://example.com".to_string(),
|
|
3246
|
+
* text: "Example".to_string(),
|
|
3247
|
+
* title: Some("Visit Example".to_string()),
|
|
3248
|
+
* link_type: LinkType::External,
|
|
3249
|
+
* rel: vec!["nofollow".to_string()],
|
|
3250
|
+
* attributes: Default::default(),
|
|
3251
|
+
* };
|
|
3252
|
+
*
|
|
3253
|
+
* assert_eq!(link.link_type, LinkType::External);
|
|
3254
|
+
* assert_eq!(link.text, "Example");
|
|
3255
|
+
* ```
|
|
3256
|
+
*/
|
|
2920
3257
|
class WasmLinkMetadata {
|
|
2921
3258
|
static __wrap(ptr) {
|
|
2922
3259
|
ptr = ptr >>> 0;
|
|
@@ -2949,6 +3286,25 @@ class WasmLinkMetadata {
|
|
|
2949
3286
|
return takeObject(ret);
|
|
2950
3287
|
}
|
|
2951
3288
|
/**
|
|
3289
|
+
* Classify a link based on href value.
|
|
3290
|
+
*
|
|
3291
|
+
* # Arguments
|
|
3292
|
+
*
|
|
3293
|
+
* * `href` - The href attribute value
|
|
3294
|
+
*
|
|
3295
|
+
* # Returns
|
|
3296
|
+
*
|
|
3297
|
+
* Appropriate [`LinkType`] based on protocol and content.
|
|
3298
|
+
*
|
|
3299
|
+
* # Examples
|
|
3300
|
+
*
|
|
3301
|
+
* ```
|
|
3302
|
+
* # use html_to_markdown_rs::metadata::{LinkMetadata, LinkType};
|
|
3303
|
+
* assert_eq!(LinkMetadata::classify_link("#section"), LinkType::Anchor);
|
|
3304
|
+
* assert_eq!(LinkMetadata::classify_link("mailto:test@example.com"), LinkType::Email);
|
|
3305
|
+
* assert_eq!(LinkMetadata::classify_link("tel:+1234567890"), LinkType::Phone);
|
|
3306
|
+
* assert_eq!(LinkMetadata::classify_link("https://example.com"), LinkType::External);
|
|
3307
|
+
* ```
|
|
2952
3308
|
* @param {string} href
|
|
2953
3309
|
* @returns {WasmLinkType}
|
|
2954
3310
|
*/
|
|
@@ -2974,7 +3330,7 @@ class WasmLinkMetadata {
|
|
|
2974
3330
|
return getStringFromWasm0(r0, r1);
|
|
2975
3331
|
} finally {
|
|
2976
3332
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
2977
|
-
wasm.
|
|
3333
|
+
wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
|
|
2978
3334
|
}
|
|
2979
3335
|
}
|
|
2980
3336
|
/**
|
|
@@ -3016,7 +3372,7 @@ class WasmLinkMetadata {
|
|
|
3016
3372
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
3017
3373
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
3018
3374
|
var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
|
|
3019
|
-
wasm.
|
|
3375
|
+
wasm.__wbindgen_export4(r0, r1 * 4, 4);
|
|
3020
3376
|
return v1;
|
|
3021
3377
|
} finally {
|
|
3022
3378
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
@@ -3082,7 +3438,7 @@ class WasmLinkMetadata {
|
|
|
3082
3438
|
return getStringFromWasm0(r0, r1);
|
|
3083
3439
|
} finally {
|
|
3084
3440
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
3085
|
-
wasm.
|
|
3441
|
+
wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
|
|
3086
3442
|
}
|
|
3087
3443
|
}
|
|
3088
3444
|
/**
|
|
@@ -3097,7 +3453,7 @@ class WasmLinkMetadata {
|
|
|
3097
3453
|
let v1;
|
|
3098
3454
|
if (r0 !== 0) {
|
|
3099
3455
|
v1 = getStringFromWasm0(r0, r1).slice();
|
|
3100
|
-
wasm.
|
|
3456
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
3101
3457
|
}
|
|
3102
3458
|
return v1;
|
|
3103
3459
|
} finally {
|
|
@@ -3109,6 +3465,10 @@ if (Symbol.dispose) WasmLinkMetadata.prototype[Symbol.dispose] = WasmLinkMetadat
|
|
|
3109
3465
|
exports.WasmLinkMetadata = WasmLinkMetadata;
|
|
3110
3466
|
|
|
3111
3467
|
/**
|
|
3468
|
+
* Link rendering style in Markdown output.
|
|
3469
|
+
*
|
|
3470
|
+
* Controls whether links and images use inline `[text](url)` syntax or
|
|
3471
|
+
* reference-style `[text][1]` syntax with definitions collected at the end.
|
|
3112
3472
|
* @enum {0 | 1}
|
|
3113
3473
|
*/
|
|
3114
3474
|
const WasmLinkStyle = Object.freeze({
|
|
@@ -3118,6 +3478,9 @@ const WasmLinkStyle = Object.freeze({
|
|
|
3118
3478
|
exports.WasmLinkStyle = WasmLinkStyle;
|
|
3119
3479
|
|
|
3120
3480
|
/**
|
|
3481
|
+
* Link classification based on href value and document context.
|
|
3482
|
+
*
|
|
3483
|
+
* Used to categorize links during extraction for filtering and analysis.
|
|
3121
3484
|
* @enum {0 | 1 | 2 | 3 | 4 | 5}
|
|
3122
3485
|
*/
|
|
3123
3486
|
const WasmLinkType = Object.freeze({
|
|
@@ -3131,6 +3494,9 @@ const WasmLinkType = Object.freeze({
|
|
|
3131
3494
|
exports.WasmLinkType = WasmLinkType;
|
|
3132
3495
|
|
|
3133
3496
|
/**
|
|
3497
|
+
* List indentation character type.
|
|
3498
|
+
*
|
|
3499
|
+
* Controls whether list items are indented with spaces or tabs.
|
|
3134
3500
|
* @enum {0 | 1}
|
|
3135
3501
|
*/
|
|
3136
3502
|
const WasmListIndentType = Object.freeze({
|
|
@@ -3139,271 +3505,303 @@ const WasmListIndentType = Object.freeze({
|
|
|
3139
3505
|
});
|
|
3140
3506
|
exports.WasmListIndentType = WasmListIndentType;
|
|
3141
3507
|
|
|
3142
|
-
|
|
3143
|
-
|
|
3144
|
-
|
|
3145
|
-
|
|
3146
|
-
|
|
3147
|
-
|
|
3148
|
-
|
|
3149
|
-
|
|
3508
|
+
/**
|
|
3509
|
+
* Line break syntax in Markdown output.
|
|
3510
|
+
*
|
|
3511
|
+
* Controls how soft line breaks (from `<br>` or line breaks in source) are rendered.
|
|
3512
|
+
* @enum {0 | 1}
|
|
3513
|
+
*/
|
|
3514
|
+
const WasmNewlineStyle = Object.freeze({
|
|
3515
|
+
Spaces: 0, "0": "Spaces",
|
|
3516
|
+
Backslash: 1, "1": "Backslash",
|
|
3517
|
+
});
|
|
3518
|
+
exports.WasmNewlineStyle = WasmNewlineStyle;
|
|
3519
|
+
|
|
3520
|
+
/**
|
|
3521
|
+
* The semantic content type of a document node.
|
|
3522
|
+
*
|
|
3523
|
+
* Uses internally tagged representation (`"node_type": "heading"`) for JSON serialization.
|
|
3524
|
+
* @enum {0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12}
|
|
3525
|
+
*/
|
|
3526
|
+
const WasmNodeContent = Object.freeze({
|
|
3527
|
+
Heading: 0, "0": "Heading",
|
|
3528
|
+
Paragraph: 1, "1": "Paragraph",
|
|
3529
|
+
List: 2, "2": "List",
|
|
3530
|
+
ListItem: 3, "3": "ListItem",
|
|
3531
|
+
Table: 4, "4": "Table",
|
|
3532
|
+
Image: 5, "5": "Image",
|
|
3533
|
+
Code: 6, "6": "Code",
|
|
3534
|
+
Quote: 7, "7": "Quote",
|
|
3535
|
+
DefinitionList: 8, "8": "DefinitionList",
|
|
3536
|
+
DefinitionItem: 9, "9": "DefinitionItem",
|
|
3537
|
+
RawBlock: 10, "10": "RawBlock",
|
|
3538
|
+
MetadataBlock: 11, "11": "MetadataBlock",
|
|
3539
|
+
Group: 12, "12": "Group",
|
|
3540
|
+
});
|
|
3541
|
+
exports.WasmNodeContent = WasmNodeContent;
|
|
3542
|
+
|
|
3543
|
+
/**
|
|
3544
|
+
* Context information passed to all visitor methods.
|
|
3545
|
+
*
|
|
3546
|
+
* Provides comprehensive metadata about the current node being visited,
|
|
3547
|
+
* including its type, attributes, position in the DOM tree, and parent context.
|
|
3548
|
+
*/
|
|
3549
|
+
class WasmNodeContext {
|
|
3150
3550
|
__destroy_into_raw() {
|
|
3151
3551
|
const ptr = this.__wbg_ptr;
|
|
3152
3552
|
this.__wbg_ptr = 0;
|
|
3153
|
-
|
|
3553
|
+
WasmNodeContextFinalization.unregister(this);
|
|
3154
3554
|
return ptr;
|
|
3155
3555
|
}
|
|
3156
3556
|
free() {
|
|
3157
3557
|
const ptr = this.__destroy_into_raw();
|
|
3158
|
-
wasm.
|
|
3159
|
-
}
|
|
3160
|
-
/**
|
|
3161
|
-
* @returns {boolean}
|
|
3162
|
-
*/
|
|
3163
|
-
anyEnabled() {
|
|
3164
|
-
const ret = wasm.wasmmetadataconfig_anyEnabled(this.__wbg_ptr);
|
|
3165
|
-
return ret !== 0;
|
|
3558
|
+
wasm.__wbg_wasmnodecontext_free(ptr, 0);
|
|
3166
3559
|
}
|
|
3167
3560
|
/**
|
|
3168
|
-
* @returns {
|
|
3169
|
-
*/
|
|
3170
|
-
static default() {
|
|
3171
|
-
const ret = wasm.wasmmetadataconfig_default();
|
|
3172
|
-
return WasmMetadataConfig.__wrap(ret);
|
|
3173
|
-
}
|
|
3174
|
-
/**
|
|
3175
|
-
* @returns {boolean}
|
|
3176
|
-
*/
|
|
3177
|
-
get extractDocument() {
|
|
3178
|
-
const ret = wasm.wasmmetadataconfig_extractDocument(this.__wbg_ptr);
|
|
3179
|
-
return ret !== 0;
|
|
3180
|
-
}
|
|
3181
|
-
/**
|
|
3182
|
-
* @returns {boolean}
|
|
3561
|
+
* @returns {WasmConversionResult}
|
|
3183
3562
|
*/
|
|
3184
|
-
get
|
|
3185
|
-
const ret = wasm.
|
|
3186
|
-
return ret
|
|
3563
|
+
get attributes() {
|
|
3564
|
+
const ret = wasm.wasmnodecontext_attributes(this.__wbg_ptr);
|
|
3565
|
+
return takeObject(ret);
|
|
3187
3566
|
}
|
|
3188
3567
|
/**
|
|
3189
|
-
* @returns {
|
|
3568
|
+
* @returns {number}
|
|
3190
3569
|
*/
|
|
3191
|
-
get
|
|
3192
|
-
const ret = wasm.
|
|
3193
|
-
return ret
|
|
3570
|
+
get depth() {
|
|
3571
|
+
const ret = wasm.wasmnodecontext_depth(this.__wbg_ptr);
|
|
3572
|
+
return ret >>> 0;
|
|
3194
3573
|
}
|
|
3195
3574
|
/**
|
|
3196
|
-
* @returns {
|
|
3575
|
+
* @returns {number}
|
|
3197
3576
|
*/
|
|
3198
|
-
get
|
|
3199
|
-
const ret = wasm.
|
|
3200
|
-
return ret
|
|
3577
|
+
get indexInParent() {
|
|
3578
|
+
const ret = wasm.wasmnodecontext_indexInParent(this.__wbg_ptr);
|
|
3579
|
+
return ret >>> 0;
|
|
3201
3580
|
}
|
|
3202
3581
|
/**
|
|
3203
3582
|
* @returns {boolean}
|
|
3204
3583
|
*/
|
|
3205
|
-
get
|
|
3206
|
-
const ret = wasm.
|
|
3584
|
+
get isInline() {
|
|
3585
|
+
const ret = wasm.wasmnodecontext_isInline(this.__wbg_ptr);
|
|
3207
3586
|
return ret !== 0;
|
|
3208
3587
|
}
|
|
3209
3588
|
/**
|
|
3210
|
-
* @
|
|
3211
|
-
|
|
3212
|
-
|
|
3213
|
-
|
|
3214
|
-
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
* @param {boolean | null} [extract_document]
|
|
3218
|
-
* @param {boolean | null} [extract_headers]
|
|
3219
|
-
* @param {boolean | null} [extract_links]
|
|
3220
|
-
* @param {boolean | null} [extract_images]
|
|
3221
|
-
* @param {boolean | null} [extract_structured_data]
|
|
3222
|
-
* @param {number | null} [max_structured_data_size]
|
|
3589
|
+
* @param {WasmNodeType} node_type
|
|
3590
|
+
* @param {string} tag_name
|
|
3591
|
+
* @param {any} attributes
|
|
3592
|
+
* @param {number} depth
|
|
3593
|
+
* @param {number} index_in_parent
|
|
3594
|
+
* @param {boolean} is_inline
|
|
3595
|
+
* @param {string | null} [parent_tag]
|
|
3223
3596
|
*/
|
|
3224
|
-
constructor(
|
|
3225
|
-
const
|
|
3597
|
+
constructor(node_type, tag_name, attributes, depth, index_in_parent, is_inline, parent_tag) {
|
|
3598
|
+
const ptr0 = passStringToWasm0(tag_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
3599
|
+
const len0 = WASM_VECTOR_LEN;
|
|
3600
|
+
var ptr1 = isLikeNone(parent_tag) ? 0 : passStringToWasm0(parent_tag, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
3601
|
+
var len1 = WASM_VECTOR_LEN;
|
|
3602
|
+
const ret = wasm.wasmnodecontext_new(node_type, ptr0, len0, addHeapObject(attributes), depth, index_in_parent, is_inline, ptr1, len1);
|
|
3226
3603
|
this.__wbg_ptr = ret >>> 0;
|
|
3227
|
-
|
|
3604
|
+
WasmNodeContextFinalization.register(this, this.__wbg_ptr, this);
|
|
3228
3605
|
return this;
|
|
3229
3606
|
}
|
|
3230
3607
|
/**
|
|
3231
|
-
* @
|
|
3232
|
-
*/
|
|
3233
|
-
set extractDocument(value) {
|
|
3234
|
-
wasm.wasmmetadataconfig_set_extractDocument(this.__wbg_ptr, value);
|
|
3235
|
-
}
|
|
3236
|
-
/**
|
|
3237
|
-
* @param {boolean} value
|
|
3238
|
-
*/
|
|
3239
|
-
set extractHeaders(value) {
|
|
3240
|
-
wasm.wasmmetadataconfig_set_extractHeaders(this.__wbg_ptr, value);
|
|
3241
|
-
}
|
|
3242
|
-
/**
|
|
3243
|
-
* @param {boolean} value
|
|
3608
|
+
* @returns {WasmNodeType}
|
|
3244
3609
|
*/
|
|
3245
|
-
|
|
3246
|
-
wasm.
|
|
3610
|
+
get nodeType() {
|
|
3611
|
+
const ret = wasm.wasmnodecontext_nodeType(this.__wbg_ptr);
|
|
3612
|
+
return ret;
|
|
3247
3613
|
}
|
|
3248
3614
|
/**
|
|
3249
|
-
* @
|
|
3615
|
+
* @returns {string | undefined}
|
|
3250
3616
|
*/
|
|
3251
|
-
|
|
3252
|
-
|
|
3617
|
+
get parentTag() {
|
|
3618
|
+
try {
|
|
3619
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
3620
|
+
wasm.wasmnodecontext_parentTag(retptr, this.__wbg_ptr);
|
|
3621
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
3622
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
3623
|
+
let v1;
|
|
3624
|
+
if (r0 !== 0) {
|
|
3625
|
+
v1 = getStringFromWasm0(r0, r1).slice();
|
|
3626
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
3627
|
+
}
|
|
3628
|
+
return v1;
|
|
3629
|
+
} finally {
|
|
3630
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
3631
|
+
}
|
|
3253
3632
|
}
|
|
3254
3633
|
/**
|
|
3255
|
-
* @param {
|
|
3634
|
+
* @param {any} value
|
|
3256
3635
|
*/
|
|
3257
|
-
set
|
|
3258
|
-
wasm.
|
|
3636
|
+
set attributes(value) {
|
|
3637
|
+
wasm.wasmnodecontext_set_attributes(this.__wbg_ptr, addHeapObject(value));
|
|
3259
3638
|
}
|
|
3260
3639
|
/**
|
|
3261
3640
|
* @param {number} value
|
|
3262
3641
|
*/
|
|
3263
|
-
set
|
|
3264
|
-
wasm.
|
|
3265
|
-
}
|
|
3266
|
-
}
|
|
3267
|
-
if (Symbol.dispose) WasmMetadataConfig.prototype[Symbol.dispose] = WasmMetadataConfig.prototype.free;
|
|
3268
|
-
exports.WasmMetadataConfig = WasmMetadataConfig;
|
|
3269
|
-
|
|
3270
|
-
class WasmMetadataConfigUpdate {
|
|
3271
|
-
__destroy_into_raw() {
|
|
3272
|
-
const ptr = this.__wbg_ptr;
|
|
3273
|
-
this.__wbg_ptr = 0;
|
|
3274
|
-
WasmMetadataConfigUpdateFinalization.unregister(this);
|
|
3275
|
-
return ptr;
|
|
3276
|
-
}
|
|
3277
|
-
free() {
|
|
3278
|
-
const ptr = this.__destroy_into_raw();
|
|
3279
|
-
wasm.__wbg_wasmmetadataconfigupdate_free(ptr, 0);
|
|
3280
|
-
}
|
|
3281
|
-
/**
|
|
3282
|
-
* @returns {boolean | undefined}
|
|
3283
|
-
*/
|
|
3284
|
-
get extractDocument() {
|
|
3285
|
-
const ret = wasm.wasmmetadataconfigupdate_extractDocument(this.__wbg_ptr);
|
|
3286
|
-
return ret === 0xFFFFFF ? undefined : ret !== 0;
|
|
3287
|
-
}
|
|
3288
|
-
/**
|
|
3289
|
-
* @returns {boolean | undefined}
|
|
3290
|
-
*/
|
|
3291
|
-
get extractHeaders() {
|
|
3292
|
-
const ret = wasm.wasmmetadataconfigupdate_extractHeaders(this.__wbg_ptr);
|
|
3293
|
-
return ret === 0xFFFFFF ? undefined : ret !== 0;
|
|
3294
|
-
}
|
|
3295
|
-
/**
|
|
3296
|
-
* @returns {boolean | undefined}
|
|
3297
|
-
*/
|
|
3298
|
-
get extractImages() {
|
|
3299
|
-
const ret = wasm.wasmmetadataconfigupdate_extractImages(this.__wbg_ptr);
|
|
3300
|
-
return ret === 0xFFFFFF ? undefined : ret !== 0;
|
|
3301
|
-
}
|
|
3302
|
-
/**
|
|
3303
|
-
* @returns {boolean | undefined}
|
|
3304
|
-
*/
|
|
3305
|
-
get extractLinks() {
|
|
3306
|
-
const ret = wasm.wasmmetadataconfigupdate_extractLinks(this.__wbg_ptr);
|
|
3307
|
-
return ret === 0xFFFFFF ? undefined : ret !== 0;
|
|
3308
|
-
}
|
|
3309
|
-
/**
|
|
3310
|
-
* @returns {boolean | undefined}
|
|
3311
|
-
*/
|
|
3312
|
-
get extractStructuredData() {
|
|
3313
|
-
const ret = wasm.wasmmetadataconfigupdate_extractStructuredData(this.__wbg_ptr);
|
|
3314
|
-
return ret === 0xFFFFFF ? undefined : ret !== 0;
|
|
3315
|
-
}
|
|
3316
|
-
/**
|
|
3317
|
-
* @returns {number | undefined}
|
|
3318
|
-
*/
|
|
3319
|
-
get maxStructuredDataSize() {
|
|
3320
|
-
const ret = wasm.wasmmetadataconfigupdate_maxStructuredDataSize(this.__wbg_ptr);
|
|
3321
|
-
return ret === 0x100000001 ? undefined : ret;
|
|
3322
|
-
}
|
|
3323
|
-
/**
|
|
3324
|
-
* @param {boolean | null} [extract_document]
|
|
3325
|
-
* @param {boolean | null} [extract_headers]
|
|
3326
|
-
* @param {boolean | null} [extract_links]
|
|
3327
|
-
* @param {boolean | null} [extract_images]
|
|
3328
|
-
* @param {boolean | null} [extract_structured_data]
|
|
3329
|
-
* @param {number | null} [max_structured_data_size]
|
|
3330
|
-
*/
|
|
3331
|
-
constructor(extract_document, extract_headers, extract_links, extract_images, extract_structured_data, max_structured_data_size) {
|
|
3332
|
-
const ret = wasm.wasmmetadataconfigupdate_new(isLikeNone(extract_document) ? 0xFFFFFF : extract_document ? 1 : 0, isLikeNone(extract_headers) ? 0xFFFFFF : extract_headers ? 1 : 0, isLikeNone(extract_links) ? 0xFFFFFF : extract_links ? 1 : 0, isLikeNone(extract_images) ? 0xFFFFFF : extract_images ? 1 : 0, isLikeNone(extract_structured_data) ? 0xFFFFFF : extract_structured_data ? 1 : 0, isLikeNone(max_structured_data_size) ? 0x100000001 : (max_structured_data_size) >>> 0);
|
|
3333
|
-
this.__wbg_ptr = ret >>> 0;
|
|
3334
|
-
WasmMetadataConfigUpdateFinalization.register(this, this.__wbg_ptr, this);
|
|
3335
|
-
return this;
|
|
3642
|
+
set depth(value) {
|
|
3643
|
+
wasm.wasmnodecontext_set_depth(this.__wbg_ptr, value);
|
|
3336
3644
|
}
|
|
3337
3645
|
/**
|
|
3338
|
-
* @param {
|
|
3646
|
+
* @param {number} value
|
|
3339
3647
|
*/
|
|
3340
|
-
set
|
|
3341
|
-
wasm.
|
|
3648
|
+
set indexInParent(value) {
|
|
3649
|
+
wasm.wasmnodecontext_set_indexInParent(this.__wbg_ptr, value);
|
|
3342
3650
|
}
|
|
3343
3651
|
/**
|
|
3344
|
-
* @param {boolean
|
|
3652
|
+
* @param {boolean} value
|
|
3345
3653
|
*/
|
|
3346
|
-
set
|
|
3347
|
-
wasm.
|
|
3654
|
+
set isInline(value) {
|
|
3655
|
+
wasm.wasmnodecontext_set_isInline(this.__wbg_ptr, value);
|
|
3348
3656
|
}
|
|
3349
3657
|
/**
|
|
3350
|
-
* @param {
|
|
3658
|
+
* @param {WasmNodeType} value
|
|
3351
3659
|
*/
|
|
3352
|
-
set
|
|
3353
|
-
wasm.
|
|
3660
|
+
set nodeType(value) {
|
|
3661
|
+
wasm.wasmnodecontext_set_nodeType(this.__wbg_ptr, value);
|
|
3354
3662
|
}
|
|
3355
3663
|
/**
|
|
3356
|
-
* @param {
|
|
3664
|
+
* @param {string | null} [value]
|
|
3357
3665
|
*/
|
|
3358
|
-
set
|
|
3359
|
-
|
|
3666
|
+
set parentTag(value) {
|
|
3667
|
+
var ptr0 = isLikeNone(value) ? 0 : passStringToWasm0(value, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
3668
|
+
var len0 = WASM_VECTOR_LEN;
|
|
3669
|
+
wasm.wasmnodecontext_set_parentTag(this.__wbg_ptr, ptr0, len0);
|
|
3360
3670
|
}
|
|
3361
3671
|
/**
|
|
3362
|
-
* @param {
|
|
3672
|
+
* @param {string} value
|
|
3363
3673
|
*/
|
|
3364
|
-
set
|
|
3365
|
-
|
|
3674
|
+
set tagName(value) {
|
|
3675
|
+
const ptr0 = passStringToWasm0(value, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
3676
|
+
const len0 = WASM_VECTOR_LEN;
|
|
3677
|
+
wasm.wasmnodecontext_set_tagName(this.__wbg_ptr, ptr0, len0);
|
|
3366
3678
|
}
|
|
3367
3679
|
/**
|
|
3368
|
-
* @
|
|
3680
|
+
* @returns {string}
|
|
3369
3681
|
*/
|
|
3370
|
-
|
|
3371
|
-
|
|
3682
|
+
get tagName() {
|
|
3683
|
+
let deferred1_0;
|
|
3684
|
+
let deferred1_1;
|
|
3685
|
+
try {
|
|
3686
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
3687
|
+
wasm.wasmnodecontext_tagName(retptr, this.__wbg_ptr);
|
|
3688
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
3689
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
3690
|
+
deferred1_0 = r0;
|
|
3691
|
+
deferred1_1 = r1;
|
|
3692
|
+
return getStringFromWasm0(r0, r1);
|
|
3693
|
+
} finally {
|
|
3694
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
3695
|
+
wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
|
|
3696
|
+
}
|
|
3372
3697
|
}
|
|
3373
3698
|
}
|
|
3374
|
-
if (Symbol.dispose)
|
|
3375
|
-
exports.
|
|
3699
|
+
if (Symbol.dispose) WasmNodeContext.prototype[Symbol.dispose] = WasmNodeContext.prototype.free;
|
|
3700
|
+
exports.WasmNodeContext = WasmNodeContext;
|
|
3376
3701
|
|
|
3377
3702
|
/**
|
|
3378
|
-
*
|
|
3703
|
+
* Node type enumeration covering all HTML element types.
|
|
3704
|
+
*
|
|
3705
|
+
* This enum categorizes all HTML elements that the converter recognizes,
|
|
3706
|
+
* providing a coarse-grained classification for visitor dispatch.
|
|
3707
|
+
* @enum {0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87}
|
|
3379
3708
|
*/
|
|
3380
|
-
const
|
|
3381
|
-
|
|
3382
|
-
|
|
3709
|
+
const WasmNodeType = Object.freeze({
|
|
3710
|
+
Text: 0, "0": "Text",
|
|
3711
|
+
Element: 1, "1": "Element",
|
|
3712
|
+
Heading: 2, "2": "Heading",
|
|
3713
|
+
Paragraph: 3, "3": "Paragraph",
|
|
3714
|
+
Div: 4, "4": "Div",
|
|
3715
|
+
Blockquote: 5, "5": "Blockquote",
|
|
3716
|
+
Pre: 6, "6": "Pre",
|
|
3717
|
+
Hr: 7, "7": "Hr",
|
|
3718
|
+
List: 8, "8": "List",
|
|
3719
|
+
ListItem: 9, "9": "ListItem",
|
|
3720
|
+
DefinitionList: 10, "10": "DefinitionList",
|
|
3721
|
+
DefinitionTerm: 11, "11": "DefinitionTerm",
|
|
3722
|
+
DefinitionDescription: 12, "12": "DefinitionDescription",
|
|
3723
|
+
Table: 13, "13": "Table",
|
|
3724
|
+
TableRow: 14, "14": "TableRow",
|
|
3725
|
+
TableCell: 15, "15": "TableCell",
|
|
3726
|
+
TableHeader: 16, "16": "TableHeader",
|
|
3727
|
+
TableBody: 17, "17": "TableBody",
|
|
3728
|
+
TableHead: 18, "18": "TableHead",
|
|
3729
|
+
TableFoot: 19, "19": "TableFoot",
|
|
3730
|
+
Link: 20, "20": "Link",
|
|
3731
|
+
Image: 21, "21": "Image",
|
|
3732
|
+
Strong: 22, "22": "Strong",
|
|
3733
|
+
Em: 23, "23": "Em",
|
|
3734
|
+
Code: 24, "24": "Code",
|
|
3735
|
+
Strikethrough: 25, "25": "Strikethrough",
|
|
3736
|
+
Underline: 26, "26": "Underline",
|
|
3737
|
+
Subscript: 27, "27": "Subscript",
|
|
3738
|
+
Superscript: 28, "28": "Superscript",
|
|
3739
|
+
Mark: 29, "29": "Mark",
|
|
3740
|
+
Small: 30, "30": "Small",
|
|
3741
|
+
Br: 31, "31": "Br",
|
|
3742
|
+
Span: 32, "32": "Span",
|
|
3743
|
+
Article: 33, "33": "Article",
|
|
3744
|
+
Section: 34, "34": "Section",
|
|
3745
|
+
Nav: 35, "35": "Nav",
|
|
3746
|
+
Aside: 36, "36": "Aside",
|
|
3747
|
+
Header: 37, "37": "Header",
|
|
3748
|
+
Footer: 38, "38": "Footer",
|
|
3749
|
+
Main: 39, "39": "Main",
|
|
3750
|
+
Figure: 40, "40": "Figure",
|
|
3751
|
+
Figcaption: 41, "41": "Figcaption",
|
|
3752
|
+
Time: 42, "42": "Time",
|
|
3753
|
+
Details: 43, "43": "Details",
|
|
3754
|
+
Summary: 44, "44": "Summary",
|
|
3755
|
+
Form: 45, "45": "Form",
|
|
3756
|
+
Input: 46, "46": "Input",
|
|
3757
|
+
Select: 47, "47": "Select",
|
|
3758
|
+
Option: 48, "48": "Option",
|
|
3759
|
+
Button: 49, "49": "Button",
|
|
3760
|
+
Textarea: 50, "50": "Textarea",
|
|
3761
|
+
Label: 51, "51": "Label",
|
|
3762
|
+
Fieldset: 52, "52": "Fieldset",
|
|
3763
|
+
Legend: 53, "53": "Legend",
|
|
3764
|
+
Audio: 54, "54": "Audio",
|
|
3765
|
+
Video: 55, "55": "Video",
|
|
3766
|
+
Picture: 56, "56": "Picture",
|
|
3767
|
+
Source: 57, "57": "Source",
|
|
3768
|
+
Iframe: 58, "58": "Iframe",
|
|
3769
|
+
Svg: 59, "59": "Svg",
|
|
3770
|
+
Canvas: 60, "60": "Canvas",
|
|
3771
|
+
Ruby: 61, "61": "Ruby",
|
|
3772
|
+
Rt: 62, "62": "Rt",
|
|
3773
|
+
Rp: 63, "63": "Rp",
|
|
3774
|
+
Abbr: 64, "64": "Abbr",
|
|
3775
|
+
Kbd: 65, "65": "Kbd",
|
|
3776
|
+
Samp: 66, "66": "Samp",
|
|
3777
|
+
Var: 67, "67": "Var",
|
|
3778
|
+
Cite: 68, "68": "Cite",
|
|
3779
|
+
Q: 69, "69": "Q",
|
|
3780
|
+
Del: 70, "70": "Del",
|
|
3781
|
+
Ins: 71, "71": "Ins",
|
|
3782
|
+
Data: 72, "72": "Data",
|
|
3783
|
+
Meter: 73, "73": "Meter",
|
|
3784
|
+
Progress: 74, "74": "Progress",
|
|
3785
|
+
Output: 75, "75": "Output",
|
|
3786
|
+
Template: 76, "76": "Template",
|
|
3787
|
+
Slot: 77, "77": "Slot",
|
|
3788
|
+
Html: 78, "78": "Html",
|
|
3789
|
+
Head: 79, "79": "Head",
|
|
3790
|
+
Body: 80, "80": "Body",
|
|
3791
|
+
Title: 81, "81": "Title",
|
|
3792
|
+
Meta: 82, "82": "Meta",
|
|
3793
|
+
LinkTag: 83, "83": "LinkTag",
|
|
3794
|
+
Style: 84, "84": "Style",
|
|
3795
|
+
Script: 85, "85": "Script",
|
|
3796
|
+
Base: 86, "86": "Base",
|
|
3797
|
+
Custom: 87, "87": "Custom",
|
|
3383
3798
|
});
|
|
3384
|
-
exports.
|
|
3385
|
-
|
|
3386
|
-
/**
|
|
3387
|
-
* @enum {0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12}
|
|
3388
|
-
*/
|
|
3389
|
-
const WasmNodeContent = Object.freeze({
|
|
3390
|
-
Heading: 0, "0": "Heading",
|
|
3391
|
-
Paragraph: 1, "1": "Paragraph",
|
|
3392
|
-
List: 2, "2": "List",
|
|
3393
|
-
ListItem: 3, "3": "ListItem",
|
|
3394
|
-
Table: 4, "4": "Table",
|
|
3395
|
-
Image: 5, "5": "Image",
|
|
3396
|
-
Code: 6, "6": "Code",
|
|
3397
|
-
Quote: 7, "7": "Quote",
|
|
3398
|
-
DefinitionList: 8, "8": "DefinitionList",
|
|
3399
|
-
DefinitionItem: 9, "9": "DefinitionItem",
|
|
3400
|
-
RawBlock: 10, "10": "RawBlock",
|
|
3401
|
-
MetadataBlock: 11, "11": "MetadataBlock",
|
|
3402
|
-
Group: 12, "12": "Group",
|
|
3403
|
-
});
|
|
3404
|
-
exports.WasmNodeContent = WasmNodeContent;
|
|
3799
|
+
exports.WasmNodeType = WasmNodeType;
|
|
3405
3800
|
|
|
3406
3801
|
/**
|
|
3802
|
+
* Output format for conversion.
|
|
3803
|
+
*
|
|
3804
|
+
* Specifies the target markup language format for the conversion output.
|
|
3407
3805
|
* @enum {0 | 1 | 2}
|
|
3408
3806
|
*/
|
|
3409
3807
|
const WasmOutputFormat = Object.freeze({
|
|
@@ -3413,6 +3811,9 @@ const WasmOutputFormat = Object.freeze({
|
|
|
3413
3811
|
});
|
|
3414
3812
|
exports.WasmOutputFormat = WasmOutputFormat;
|
|
3415
3813
|
|
|
3814
|
+
/**
|
|
3815
|
+
* HTML preprocessing options for document cleanup before conversion.
|
|
3816
|
+
*/
|
|
3416
3817
|
class WasmPreprocessingOptions {
|
|
3417
3818
|
static __wrap(ptr) {
|
|
3418
3819
|
ptr = ptr >>> 0;
|
|
@@ -3431,6 +3832,22 @@ class WasmPreprocessingOptions {
|
|
|
3431
3832
|
const ptr = this.__destroy_into_raw();
|
|
3432
3833
|
wasm.__wbg_wasmpreprocessingoptions_free(ptr, 0);
|
|
3433
3834
|
}
|
|
3835
|
+
/**
|
|
3836
|
+
* Apply a partial update to these preprocessing options.
|
|
3837
|
+
*
|
|
3838
|
+
* Any specified fields in the update will override the current values.
|
|
3839
|
+
* Unspecified fields (None) are left unchanged.
|
|
3840
|
+
*
|
|
3841
|
+
* # Arguments
|
|
3842
|
+
*
|
|
3843
|
+
* * `update` - Partial preprocessing options update
|
|
3844
|
+
* @param {WasmPreprocessingOptionsUpdate} _update
|
|
3845
|
+
*/
|
|
3846
|
+
applyUpdate(_update) {
|
|
3847
|
+
_assertClass(_update, WasmPreprocessingOptionsUpdate);
|
|
3848
|
+
var ptr0 = _update.__destroy_into_raw();
|
|
3849
|
+
wasm.wasmpreprocessingoptions_applyUpdate(this.__wbg_ptr, ptr0);
|
|
3850
|
+
}
|
|
3434
3851
|
/**
|
|
3435
3852
|
* @returns {WasmPreprocessingOptions}
|
|
3436
3853
|
*/
|
|
@@ -3445,6 +3862,38 @@ class WasmPreprocessingOptions {
|
|
|
3445
3862
|
const ret = wasm.wasmpreprocessingoptions_enabled(this.__wbg_ptr);
|
|
3446
3863
|
return ret !== 0;
|
|
3447
3864
|
}
|
|
3865
|
+
/**
|
|
3866
|
+
* @param {WasmPreprocessingOptionsUpdate} update
|
|
3867
|
+
* @returns {WasmPreprocessingOptions}
|
|
3868
|
+
*/
|
|
3869
|
+
static from(update) {
|
|
3870
|
+
_assertClass(update, WasmPreprocessingOptionsUpdate);
|
|
3871
|
+
var ptr0 = update.__destroy_into_raw();
|
|
3872
|
+
const ret = wasm.wasmpreprocessingoptions_from(ptr0);
|
|
3873
|
+
return WasmPreprocessingOptions.__wrap(ret);
|
|
3874
|
+
}
|
|
3875
|
+
/**
|
|
3876
|
+
* Create new preprocessing options from a partial update.
|
|
3877
|
+
*
|
|
3878
|
+
* Creates a new `PreprocessingOptions` struct with defaults, then applies the update.
|
|
3879
|
+
* Fields not specified in the update keep their default values.
|
|
3880
|
+
*
|
|
3881
|
+
* # Arguments
|
|
3882
|
+
*
|
|
3883
|
+
* * `update` - Partial preprocessing options update
|
|
3884
|
+
*
|
|
3885
|
+
* # Returns
|
|
3886
|
+
*
|
|
3887
|
+
* New `PreprocessingOptions` with specified updates applied to defaults
|
|
3888
|
+
* @param {WasmPreprocessingOptionsUpdate} update
|
|
3889
|
+
* @returns {WasmPreprocessingOptions}
|
|
3890
|
+
*/
|
|
3891
|
+
static fromUpdate(update) {
|
|
3892
|
+
_assertClass(update, WasmPreprocessingOptionsUpdate);
|
|
3893
|
+
var ptr0 = update.__destroy_into_raw();
|
|
3894
|
+
const ret = wasm.wasmpreprocessingoptions_fromUpdate(ptr0);
|
|
3895
|
+
return WasmPreprocessingOptions.__wrap(ret);
|
|
3896
|
+
}
|
|
3448
3897
|
/**
|
|
3449
3898
|
* @param {boolean | null} [enabled]
|
|
3450
3899
|
* @param {WasmPreprocessingPreset | null} [preset]
|
|
@@ -3506,6 +3955,13 @@ class WasmPreprocessingOptions {
|
|
|
3506
3955
|
if (Symbol.dispose) WasmPreprocessingOptions.prototype[Symbol.dispose] = WasmPreprocessingOptions.prototype.free;
|
|
3507
3956
|
exports.WasmPreprocessingOptions = WasmPreprocessingOptions;
|
|
3508
3957
|
|
|
3958
|
+
/**
|
|
3959
|
+
* Partial update for `PreprocessingOptions`.
|
|
3960
|
+
*
|
|
3961
|
+
* This struct uses `Option<T>` to represent optional fields that can be selectively updated.
|
|
3962
|
+
* Only specified fields (Some values) will override existing options; None values leave the
|
|
3963
|
+
* corresponding fields unchanged when applied via [`PreprocessingOptions::apply_update`].
|
|
3964
|
+
*/
|
|
3509
3965
|
class WasmPreprocessingOptionsUpdate {
|
|
3510
3966
|
static __wrap(ptr) {
|
|
3511
3967
|
ptr = ptr >>> 0;
|
|
@@ -3593,6 +4049,9 @@ if (Symbol.dispose) WasmPreprocessingOptionsUpdate.prototype[Symbol.dispose] = W
|
|
|
3593
4049
|
exports.WasmPreprocessingOptionsUpdate = WasmPreprocessingOptionsUpdate;
|
|
3594
4050
|
|
|
3595
4051
|
/**
|
|
4052
|
+
* HTML preprocessing aggressiveness level.
|
|
4053
|
+
*
|
|
4054
|
+
* Controls the extent of cleanup performed before conversion. Higher levels remove more elements.
|
|
3596
4055
|
* @enum {0 | 1 | 2}
|
|
3597
4056
|
*/
|
|
3598
4057
|
const WasmPreprocessingPreset = Object.freeze({
|
|
@@ -3602,6 +4061,9 @@ const WasmPreprocessingPreset = Object.freeze({
|
|
|
3602
4061
|
});
|
|
3603
4062
|
exports.WasmPreprocessingPreset = WasmPreprocessingPreset;
|
|
3604
4063
|
|
|
4064
|
+
/**
|
|
4065
|
+
* A non-fatal warning generated during HTML processing.
|
|
4066
|
+
*/
|
|
3605
4067
|
class WasmProcessingWarning {
|
|
3606
4068
|
static __wrap(ptr) {
|
|
3607
4069
|
ptr = ptr >>> 0;
|
|
@@ -3649,7 +4111,7 @@ class WasmProcessingWarning {
|
|
|
3649
4111
|
return getStringFromWasm0(r0, r1);
|
|
3650
4112
|
} finally {
|
|
3651
4113
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
3652
|
-
wasm.
|
|
4114
|
+
wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
|
|
3653
4115
|
}
|
|
3654
4116
|
}
|
|
3655
4117
|
/**
|
|
@@ -3682,6 +4144,25 @@ class WasmProcessingWarning {
|
|
|
3682
4144
|
if (Symbol.dispose) WasmProcessingWarning.prototype[Symbol.dispose] = WasmProcessingWarning.prototype.free;
|
|
3683
4145
|
exports.WasmProcessingWarning = WasmProcessingWarning;
|
|
3684
4146
|
|
|
4147
|
+
/**
|
|
4148
|
+
* Structured data block (JSON-LD, Microdata, or RDFa).
|
|
4149
|
+
*
|
|
4150
|
+
* Represents machine-readable structured data found in the document.
|
|
4151
|
+
* JSON-LD blocks are collected as raw JSON strings for flexibility.
|
|
4152
|
+
*
|
|
4153
|
+
* # Examples
|
|
4154
|
+
*
|
|
4155
|
+
* ```
|
|
4156
|
+
* # use html_to_markdown_rs::metadata::{StructuredData, StructuredDataType};
|
|
4157
|
+
* let schema = StructuredData {
|
|
4158
|
+
* data_type: StructuredDataType::JsonLd,
|
|
4159
|
+
* raw_json: r#"{"@context":"https://schema.org","@type":"Article"}"#.to_string(),
|
|
4160
|
+
* schema_type: Some("Article".to_string()),
|
|
4161
|
+
* };
|
|
4162
|
+
*
|
|
4163
|
+
* assert_eq!(schema.data_type, StructuredDataType::JsonLd);
|
|
4164
|
+
* ```
|
|
4165
|
+
*/
|
|
3685
4166
|
class WasmStructuredData {
|
|
3686
4167
|
static __wrap(ptr) {
|
|
3687
4168
|
ptr = ptr >>> 0;
|
|
@@ -3744,7 +4225,7 @@ class WasmStructuredData {
|
|
|
3744
4225
|
return getStringFromWasm0(r0, r1);
|
|
3745
4226
|
} finally {
|
|
3746
4227
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
3747
|
-
wasm.
|
|
4228
|
+
wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
|
|
3748
4229
|
}
|
|
3749
4230
|
}
|
|
3750
4231
|
/**
|
|
@@ -3759,7 +4240,7 @@ class WasmStructuredData {
|
|
|
3759
4240
|
let v1;
|
|
3760
4241
|
if (r0 !== 0) {
|
|
3761
4242
|
v1 = getStringFromWasm0(r0, r1).slice();
|
|
3762
|
-
wasm.
|
|
4243
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
3763
4244
|
}
|
|
3764
4245
|
return v1;
|
|
3765
4246
|
} finally {
|
|
@@ -3793,6 +4274,9 @@ if (Symbol.dispose) WasmStructuredData.prototype[Symbol.dispose] = WasmStructure
|
|
|
3793
4274
|
exports.WasmStructuredData = WasmStructuredData;
|
|
3794
4275
|
|
|
3795
4276
|
/**
|
|
4277
|
+
* Structured data format type.
|
|
4278
|
+
*
|
|
4279
|
+
* Identifies the schema/format used for structured data markup.
|
|
3796
4280
|
* @enum {0 | 1 | 2}
|
|
3797
4281
|
*/
|
|
3798
4282
|
const WasmStructuredDataType = Object.freeze({
|
|
@@ -3802,6 +4286,9 @@ const WasmStructuredDataType = Object.freeze({
|
|
|
3802
4286
|
});
|
|
3803
4287
|
exports.WasmStructuredDataType = WasmStructuredDataType;
|
|
3804
4288
|
|
|
4289
|
+
/**
|
|
4290
|
+
* A top-level extracted table with both structured data and markdown representation.
|
|
4291
|
+
*/
|
|
3805
4292
|
class WasmTableData {
|
|
3806
4293
|
static __wrap(ptr) {
|
|
3807
4294
|
ptr = ptr >>> 0;
|
|
@@ -3849,7 +4336,7 @@ class WasmTableData {
|
|
|
3849
4336
|
return getStringFromWasm0(r0, r1);
|
|
3850
4337
|
} finally {
|
|
3851
4338
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
3852
|
-
wasm.
|
|
4339
|
+
wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
|
|
3853
4340
|
}
|
|
3854
4341
|
}
|
|
3855
4342
|
/**
|
|
@@ -3886,6 +4373,9 @@ class WasmTableData {
|
|
|
3886
4373
|
if (Symbol.dispose) WasmTableData.prototype[Symbol.dispose] = WasmTableData.prototype.free;
|
|
3887
4374
|
exports.WasmTableData = WasmTableData;
|
|
3888
4375
|
|
|
4376
|
+
/**
|
|
4377
|
+
* A structured table grid with cell-level data including spans.
|
|
4378
|
+
*/
|
|
3889
4379
|
class WasmTableGrid {
|
|
3890
4380
|
static __wrap(ptr) {
|
|
3891
4381
|
ptr = ptr >>> 0;
|
|
@@ -3914,7 +4404,7 @@ class WasmTableGrid {
|
|
|
3914
4404
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
3915
4405
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
3916
4406
|
var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
|
|
3917
|
-
wasm.
|
|
4407
|
+
wasm.__wbindgen_export4(r0, r1 * 4, 4);
|
|
3918
4408
|
return v1;
|
|
3919
4409
|
} finally {
|
|
3920
4410
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
@@ -3971,6 +4461,11 @@ class WasmTableGrid {
|
|
|
3971
4461
|
if (Symbol.dispose) WasmTableGrid.prototype[Symbol.dispose] = WasmTableGrid.prototype.free;
|
|
3972
4462
|
exports.WasmTableGrid = WasmTableGrid;
|
|
3973
4463
|
|
|
4464
|
+
/**
|
|
4465
|
+
* An inline text annotation with byte-range offsets.
|
|
4466
|
+
*
|
|
4467
|
+
* Annotations describe formatting (bold, italic, etc.) and links within a node's text content.
|
|
4468
|
+
*/
|
|
3974
4469
|
class WasmTextAnnotation {
|
|
3975
4470
|
static __wrap(ptr) {
|
|
3976
4471
|
ptr = ptr >>> 0;
|
|
@@ -4050,6 +4545,9 @@ if (Symbol.dispose) WasmTextAnnotation.prototype[Symbol.dispose] = WasmTextAnnot
|
|
|
4050
4545
|
exports.WasmTextAnnotation = WasmTextAnnotation;
|
|
4051
4546
|
|
|
4052
4547
|
/**
|
|
4548
|
+
* Text directionality of document content.
|
|
4549
|
+
*
|
|
4550
|
+
* Corresponds to the HTML `dir` attribute and `bdi` element directionality.
|
|
4053
4551
|
* @enum {0 | 1 | 2}
|
|
4054
4552
|
*/
|
|
4055
4553
|
const WasmTextDirection = Object.freeze({
|
|
@@ -4060,18 +4558,40 @@ const WasmTextDirection = Object.freeze({
|
|
|
4060
4558
|
exports.WasmTextDirection = WasmTextDirection;
|
|
4061
4559
|
|
|
4062
4560
|
/**
|
|
4561
|
+
* Result of a visitor callback.
|
|
4562
|
+
*
|
|
4563
|
+
* Allows visitors to control the conversion flow by either proceeding
|
|
4564
|
+
* with default behavior, providing custom output, skipping elements,
|
|
4565
|
+
* preserving HTML, or signaling errors.
|
|
4063
4566
|
* @enum {0 | 1 | 2 | 3 | 4}
|
|
4064
4567
|
*/
|
|
4568
|
+
const WasmVisitResult = Object.freeze({
|
|
4569
|
+
Continue: 0, "0": "Continue",
|
|
4570
|
+
Custom: 1, "1": "Custom",
|
|
4571
|
+
Skip: 2, "2": "Skip",
|
|
4572
|
+
PreserveHtml: 3, "3": "PreserveHtml",
|
|
4573
|
+
Error: 4, "4": "Error",
|
|
4574
|
+
});
|
|
4575
|
+
exports.WasmVisitResult = WasmVisitResult;
|
|
4576
|
+
|
|
4577
|
+
/**
|
|
4578
|
+
* Categories of processing warnings.
|
|
4579
|
+
* @enum {0 | 1 | 2 | 3 | 4 | 5}
|
|
4580
|
+
*/
|
|
4065
4581
|
const WasmWarningKind = Object.freeze({
|
|
4066
4582
|
ImageExtractionFailed: 0, "0": "ImageExtractionFailed",
|
|
4067
4583
|
EncodingFallback: 1, "1": "EncodingFallback",
|
|
4068
4584
|
TruncatedInput: 2, "2": "TruncatedInput",
|
|
4069
4585
|
MalformedHtml: 3, "3": "MalformedHtml",
|
|
4070
4586
|
SanitizationApplied: 4, "4": "SanitizationApplied",
|
|
4587
|
+
DepthLimitExceeded: 5, "5": "DepthLimitExceeded",
|
|
4071
4588
|
});
|
|
4072
4589
|
exports.WasmWarningKind = WasmWarningKind;
|
|
4073
4590
|
|
|
4074
4591
|
/**
|
|
4592
|
+
* Whitespace handling strategy during conversion.
|
|
4593
|
+
*
|
|
4594
|
+
* Determines how sequences of whitespace characters (spaces, tabs, newlines) are processed.
|
|
4075
4595
|
* @enum {0 | 1}
|
|
4076
4596
|
*/
|
|
4077
4597
|
const WasmWhitespaceMode = Object.freeze({
|
|
@@ -4083,9 +4603,10 @@ exports.WasmWhitespaceMode = WasmWhitespaceMode;
|
|
|
4083
4603
|
/**
|
|
4084
4604
|
* @param {string} html
|
|
4085
4605
|
* @param {WasmConversionOptions | null} [options]
|
|
4606
|
+
* @param {any | null} [visitor]
|
|
4086
4607
|
* @returns {WasmConversionResult}
|
|
4087
4608
|
*/
|
|
4088
|
-
function convert(html, options) {
|
|
4609
|
+
function convert(html, options, visitor) {
|
|
4089
4610
|
try {
|
|
4090
4611
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
4091
4612
|
const ptr0 = passStringToWasm0(html, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
@@ -4095,7 +4616,7 @@ function convert(html, options) {
|
|
|
4095
4616
|
_assertClass(options, WasmConversionOptions);
|
|
4096
4617
|
ptr1 = options.__destroy_into_raw();
|
|
4097
4618
|
}
|
|
4098
|
-
wasm.convert(retptr, ptr0, len0, ptr1);
|
|
4619
|
+
wasm.convert(retptr, ptr0, len0, ptr1, isLikeNone(visitor) ? 0 : addHeapObject(visitor));
|
|
4099
4620
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
4100
4621
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
4101
4622
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -4115,6 +4636,10 @@ function __wbg_get_imports() {
|
|
|
4115
4636
|
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
4116
4637
|
return addHeapObject(ret);
|
|
4117
4638
|
},
|
|
4639
|
+
__wbg___wbindgen_is_function_3baa9db1a987f47d: function(arg0) {
|
|
4640
|
+
const ret = typeof(getObject(arg0)) === 'function';
|
|
4641
|
+
return ret;
|
|
4642
|
+
},
|
|
4118
4643
|
__wbg___wbindgen_is_string_6df3bf7ef1164ed3: function(arg0) {
|
|
4119
4644
|
const ret = typeof(getObject(arg0)) === 'string';
|
|
4120
4645
|
return ret;
|
|
@@ -4134,14 +4659,38 @@ function __wbg_get_imports() {
|
|
|
4134
4659
|
__wbg___wbindgen_throw_6b64449b9b9ed33c: function(arg0, arg1) {
|
|
4135
4660
|
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
4136
4661
|
},
|
|
4662
|
+
__wbg_apply_4c35bd236dda9c14: function() { return handleError(function (arg0, arg1, arg2) {
|
|
4663
|
+
const ret = getObject(arg0).apply(getObject(arg1), getObject(arg2));
|
|
4664
|
+
return addHeapObject(ret);
|
|
4665
|
+
}, arguments); },
|
|
4666
|
+
__wbg_get_6011fa3a58f61074: function() { return handleError(function (arg0, arg1) {
|
|
4667
|
+
const ret = Reflect.get(getObject(arg0), getObject(arg1));
|
|
4668
|
+
return addHeapObject(ret);
|
|
4669
|
+
}, arguments); },
|
|
4670
|
+
__wbg_has_880f1d472f7cecba: function() { return handleError(function (arg0, arg1) {
|
|
4671
|
+
const ret = Reflect.has(getObject(arg0), getObject(arg1));
|
|
4672
|
+
return ret;
|
|
4673
|
+
}, arguments); },
|
|
4137
4674
|
__wbg_new_34d45cc8e36aaead: function() {
|
|
4138
4675
|
const ret = new Map();
|
|
4139
4676
|
return addHeapObject(ret);
|
|
4140
4677
|
},
|
|
4678
|
+
__wbg_new_682678e2f47e32bc: function() {
|
|
4679
|
+
const ret = new Array();
|
|
4680
|
+
return addHeapObject(ret);
|
|
4681
|
+
},
|
|
4141
4682
|
__wbg_new_aa8d0fa9762c29bd: function() {
|
|
4142
4683
|
const ret = new Object();
|
|
4143
4684
|
return addHeapObject(ret);
|
|
4144
4685
|
},
|
|
4686
|
+
__wbg_push_471a5b068a5295f6: function(arg0, arg1) {
|
|
4687
|
+
const ret = getObject(arg0).push(getObject(arg1));
|
|
4688
|
+
return ret;
|
|
4689
|
+
},
|
|
4690
|
+
__wbg_set_022bee52d0b05b19: function() { return handleError(function (arg0, arg1, arg2) {
|
|
4691
|
+
const ret = Reflect.set(getObject(arg0), getObject(arg1), getObject(arg2));
|
|
4692
|
+
return ret;
|
|
4693
|
+
}, arguments); },
|
|
4145
4694
|
__wbg_set_6be42768c690e380: function(arg0, arg1, arg2) {
|
|
4146
4695
|
getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
|
|
4147
4696
|
},
|
|
@@ -4221,7 +4770,12 @@ function __wbg_get_imports() {
|
|
|
4221
4770
|
const ret = WasmTextAnnotation.__unwrap(getObject(arg0));
|
|
4222
4771
|
return ret;
|
|
4223
4772
|
},
|
|
4224
|
-
__wbindgen_cast_0000000000000001: function(arg0
|
|
4773
|
+
__wbindgen_cast_0000000000000001: function(arg0) {
|
|
4774
|
+
// Cast intrinsic for `F64 -> Externref`.
|
|
4775
|
+
const ret = arg0;
|
|
4776
|
+
return addHeapObject(ret);
|
|
4777
|
+
},
|
|
4778
|
+
__wbindgen_cast_0000000000000002: function(arg0, arg1) {
|
|
4225
4779
|
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
4226
4780
|
const ret = getStringFromWasm0(arg0, arg1);
|
|
4227
4781
|
return addHeapObject(ret);
|
|
@@ -4276,12 +4830,9 @@ const WasmImageMetadataFinalization = (typeof FinalizationRegistry === 'undefine
|
|
|
4276
4830
|
const WasmLinkMetadataFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
4277
4831
|
? { register: () => {}, unregister: () => {} }
|
|
4278
4832
|
: new FinalizationRegistry(ptr => wasm.__wbg_wasmlinkmetadata_free(ptr >>> 0, 1));
|
|
4279
|
-
const
|
|
4833
|
+
const WasmNodeContextFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
4280
4834
|
? { register: () => {}, unregister: () => {} }
|
|
4281
|
-
: new FinalizationRegistry(ptr => wasm.
|
|
4282
|
-
const WasmMetadataConfigUpdateFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
4283
|
-
? { register: () => {}, unregister: () => {} }
|
|
4284
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_wasmmetadataconfigupdate_free(ptr >>> 0, 1));
|
|
4835
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_wasmnodecontext_free(ptr >>> 0, 1));
|
|
4285
4836
|
const WasmPreprocessingOptionsFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
4286
4837
|
? { register: () => {}, unregister: () => {} }
|
|
4287
4838
|
: new FinalizationRegistry(ptr => wasm.__wbg_wasmpreprocessingoptions_free(ptr >>> 0, 1));
|
|
@@ -4371,6 +4922,14 @@ function getUint8ArrayMemory0() {
|
|
|
4371
4922
|
|
|
4372
4923
|
function getObject(idx) { return heap[idx]; }
|
|
4373
4924
|
|
|
4925
|
+
function handleError(f, args) {
|
|
4926
|
+
try {
|
|
4927
|
+
return f.apply(this, args);
|
|
4928
|
+
} catch (e) {
|
|
4929
|
+
wasm.__wbindgen_export3(addHeapObject(e));
|
|
4930
|
+
}
|
|
4931
|
+
}
|
|
4932
|
+
|
|
4374
4933
|
let heap = new Array(1024).fill(undefined);
|
|
4375
4934
|
heap.push(undefined, null, true, false);
|
|
4376
4935
|
|