@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
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
+
* The type of an inline text annotation.
|
|
3
|
+
*
|
|
4
|
+
* Uses internally tagged representation (`"annotation_type": "bold"`) for JSON serialization.
|
|
2
5
|
* @enum {0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8}
|
|
3
6
|
*/
|
|
4
7
|
export const WasmAnnotationKind = Object.freeze({
|
|
@@ -14,6 +17,9 @@ export const WasmAnnotationKind = Object.freeze({
|
|
|
14
17
|
});
|
|
15
18
|
|
|
16
19
|
/**
|
|
20
|
+
* Code block fence style in Markdown output.
|
|
21
|
+
*
|
|
22
|
+
* Determines how code blocks (`<pre><code>`) are rendered in Markdown.
|
|
17
23
|
* @enum {0 | 1 | 2}
|
|
18
24
|
*/
|
|
19
25
|
export const WasmCodeBlockStyle = Object.freeze({
|
|
@@ -22,6 +28,23 @@ export const WasmCodeBlockStyle = Object.freeze({
|
|
|
22
28
|
Tildes: 2, "2": "Tildes",
|
|
23
29
|
});
|
|
24
30
|
|
|
31
|
+
/**
|
|
32
|
+
* Main conversion options for HTML to Markdown conversion.
|
|
33
|
+
*
|
|
34
|
+
* Use [`ConversionOptions::builder()`] to construct, or [`Default::default()`] for defaults.
|
|
35
|
+
*
|
|
36
|
+
* # Example
|
|
37
|
+
*
|
|
38
|
+
* ```text
|
|
39
|
+
* use html_to_markdown_rs::ConversionOptions;
|
|
40
|
+
*
|
|
41
|
+
* let options = ConversionOptions::builder()
|
|
42
|
+
* .heading_style(HeadingStyle::Atx)
|
|
43
|
+
* .wrap(true)
|
|
44
|
+
* .wrap_width(100)
|
|
45
|
+
* .build();
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
25
48
|
export class WasmConversionOptions {
|
|
26
49
|
static __wrap(ptr) {
|
|
27
50
|
ptr = ptr >>> 0;
|
|
@@ -40,6 +63,15 @@ export class WasmConversionOptions {
|
|
|
40
63
|
const ptr = this.__destroy_into_raw();
|
|
41
64
|
wasm.__wbg_wasmconversionoptions_free(ptr, 0);
|
|
42
65
|
}
|
|
66
|
+
/**
|
|
67
|
+
* Apply a partial update to these conversion options.
|
|
68
|
+
* @param {WasmConversionOptionsUpdate} _update
|
|
69
|
+
*/
|
|
70
|
+
applyUpdate(_update) {
|
|
71
|
+
_assertClass(_update, WasmConversionOptionsUpdate);
|
|
72
|
+
var ptr0 = _update.__destroy_into_raw();
|
|
73
|
+
wasm.wasmconversionoptions_applyUpdate(this.__wbg_ptr, ptr0);
|
|
74
|
+
}
|
|
43
75
|
/**
|
|
44
76
|
* @returns {boolean}
|
|
45
77
|
*/
|
|
@@ -55,6 +87,7 @@ export class WasmConversionOptions {
|
|
|
55
87
|
return ret !== 0;
|
|
56
88
|
}
|
|
57
89
|
/**
|
|
90
|
+
* Create a new builder with default values.
|
|
58
91
|
* @returns {WasmConversionOptionsBuilder}
|
|
59
92
|
*/
|
|
60
93
|
static builder() {
|
|
@@ -77,7 +110,7 @@ export class WasmConversionOptions {
|
|
|
77
110
|
return getStringFromWasm0(r0, r1);
|
|
78
111
|
} finally {
|
|
79
112
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
80
|
-
wasm.
|
|
113
|
+
wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
|
|
81
114
|
}
|
|
82
115
|
}
|
|
83
116
|
/**
|
|
@@ -110,7 +143,7 @@ export class WasmConversionOptions {
|
|
|
110
143
|
return getStringFromWasm0(r0, r1);
|
|
111
144
|
} finally {
|
|
112
145
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
113
|
-
wasm.
|
|
146
|
+
wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
|
|
114
147
|
}
|
|
115
148
|
}
|
|
116
149
|
/**
|
|
@@ -157,7 +190,7 @@ export class WasmConversionOptions {
|
|
|
157
190
|
return getStringFromWasm0(r0, r1);
|
|
158
191
|
} finally {
|
|
159
192
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
160
|
-
wasm.
|
|
193
|
+
wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
|
|
161
194
|
}
|
|
162
195
|
}
|
|
163
196
|
/**
|
|
@@ -188,6 +221,22 @@ export class WasmConversionOptions {
|
|
|
188
221
|
const ret = wasm.wasmconversionoptions_escapeUnderscores(this.__wbg_ptr);
|
|
189
222
|
return ret !== 0;
|
|
190
223
|
}
|
|
224
|
+
/**
|
|
225
|
+
* @returns {string[]}
|
|
226
|
+
*/
|
|
227
|
+
get excludeSelectors() {
|
|
228
|
+
try {
|
|
229
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
230
|
+
wasm.wasmconversionoptions_excludeSelectors(retptr, this.__wbg_ptr);
|
|
231
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
232
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
233
|
+
var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
|
|
234
|
+
wasm.__wbindgen_export4(r0, r1 * 4, 4);
|
|
235
|
+
return v1;
|
|
236
|
+
} finally {
|
|
237
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
238
|
+
}
|
|
239
|
+
}
|
|
191
240
|
/**
|
|
192
241
|
* @returns {boolean}
|
|
193
242
|
*/
|
|
@@ -202,6 +251,27 @@ export class WasmConversionOptions {
|
|
|
202
251
|
const ret = wasm.wasmconversionoptions_extractMetadata(this.__wbg_ptr);
|
|
203
252
|
return ret !== 0;
|
|
204
253
|
}
|
|
254
|
+
/**
|
|
255
|
+
* @param {WasmConversionOptionsUpdate} update
|
|
256
|
+
* @returns {WasmConversionOptions}
|
|
257
|
+
*/
|
|
258
|
+
static from(update) {
|
|
259
|
+
_assertClass(update, WasmConversionOptionsUpdate);
|
|
260
|
+
var ptr0 = update.__destroy_into_raw();
|
|
261
|
+
const ret = wasm.wasmconversionoptions_from(ptr0);
|
|
262
|
+
return WasmConversionOptions.__wrap(ret);
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* Create from a partial update, applying to defaults.
|
|
266
|
+
* @param {WasmConversionOptionsUpdate} update
|
|
267
|
+
* @returns {WasmConversionOptions}
|
|
268
|
+
*/
|
|
269
|
+
static fromUpdate(update) {
|
|
270
|
+
_assertClass(update, WasmConversionOptionsUpdate);
|
|
271
|
+
var ptr0 = update.__destroy_into_raw();
|
|
272
|
+
const ret = wasm.wasmconversionoptions_fromUpdate(ptr0);
|
|
273
|
+
return WasmConversionOptions.__wrap(ret);
|
|
274
|
+
}
|
|
205
275
|
/**
|
|
206
276
|
* @returns {WasmHeadingStyle}
|
|
207
277
|
*/
|
|
@@ -240,7 +310,7 @@ export class WasmConversionOptions {
|
|
|
240
310
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
241
311
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
242
312
|
var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
|
|
243
|
-
wasm.
|
|
313
|
+
wasm.__wbindgen_export4(r0, r1 * 4, 4);
|
|
244
314
|
return v1;
|
|
245
315
|
} finally {
|
|
246
316
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
@@ -267,6 +337,13 @@ export class WasmConversionOptions {
|
|
|
267
337
|
const ret = wasm.wasmconversionoptions_listIndentWidth(this.__wbg_ptr);
|
|
268
338
|
return ret >>> 0;
|
|
269
339
|
}
|
|
340
|
+
/**
|
|
341
|
+
* @returns {number | undefined}
|
|
342
|
+
*/
|
|
343
|
+
get maxDepth() {
|
|
344
|
+
const ret = wasm.wasmconversionoptions_maxDepth(this.__wbg_ptr);
|
|
345
|
+
return ret === 0x100000001 ? undefined : ret;
|
|
346
|
+
}
|
|
270
347
|
/**
|
|
271
348
|
* @returns {bigint}
|
|
272
349
|
*/
|
|
@@ -313,8 +390,10 @@ export class WasmConversionOptions {
|
|
|
313
390
|
* @param {bigint | null} [max_image_size]
|
|
314
391
|
* @param {boolean | null} [capture_svg]
|
|
315
392
|
* @param {boolean | null} [infer_dimensions]
|
|
393
|
+
* @param {string[] | null} [exclude_selectors]
|
|
394
|
+
* @param {number | null} [max_depth]
|
|
316
395
|
*/
|
|
317
|
-
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) {
|
|
396
|
+
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) {
|
|
318
397
|
var ptr0 = isLikeNone(bullets) ? 0 : passStringToWasm0(bullets, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
319
398
|
var len0 = WASM_VECTOR_LEN;
|
|
320
399
|
var ptr1 = isLikeNone(strong_em_symbol) ? 0 : passStringToWasm0(strong_em_symbol, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
@@ -338,7 +417,9 @@ export class WasmConversionOptions {
|
|
|
338
417
|
var len8 = WASM_VECTOR_LEN;
|
|
339
418
|
var ptr9 = isLikeNone(preserve_tags) ? 0 : passArrayJsValueToWasm0(preserve_tags, wasm.__wbindgen_export);
|
|
340
419
|
var len9 = WASM_VECTOR_LEN;
|
|
341
|
-
|
|
420
|
+
var ptr10 = isLikeNone(exclude_selectors) ? 0 : passArrayJsValueToWasm0(exclude_selectors, wasm.__wbindgen_export);
|
|
421
|
+
var len10 = WASM_VECTOR_LEN;
|
|
422
|
+
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);
|
|
342
423
|
this.__wbg_ptr = ret >>> 0;
|
|
343
424
|
WasmConversionOptionsFinalization.register(this, this.__wbg_ptr, this);
|
|
344
425
|
return this;
|
|
@@ -374,7 +455,7 @@ export class WasmConversionOptions {
|
|
|
374
455
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
375
456
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
376
457
|
var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
|
|
377
|
-
wasm.
|
|
458
|
+
wasm.__wbindgen_export4(r0, r1 * 4, 4);
|
|
378
459
|
return v1;
|
|
379
460
|
} finally {
|
|
380
461
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
@@ -470,6 +551,14 @@ export class WasmConversionOptions {
|
|
|
470
551
|
set escapeUnderscores(value) {
|
|
471
552
|
wasm.wasmconversionoptions_set_escapeUnderscores(this.__wbg_ptr, value);
|
|
472
553
|
}
|
|
554
|
+
/**
|
|
555
|
+
* @param {string[]} value
|
|
556
|
+
*/
|
|
557
|
+
set excludeSelectors(value) {
|
|
558
|
+
const ptr0 = passArrayJsValueToWasm0(value, wasm.__wbindgen_export);
|
|
559
|
+
const len0 = WASM_VECTOR_LEN;
|
|
560
|
+
wasm.wasmconversionoptions_set_excludeSelectors(this.__wbg_ptr, ptr0, len0);
|
|
561
|
+
}
|
|
473
562
|
/**
|
|
474
563
|
* @param {boolean} value
|
|
475
564
|
*/
|
|
@@ -532,6 +621,12 @@ export class WasmConversionOptions {
|
|
|
532
621
|
set listIndentWidth(value) {
|
|
533
622
|
wasm.wasmconversionoptions_set_listIndentWidth(this.__wbg_ptr, value);
|
|
534
623
|
}
|
|
624
|
+
/**
|
|
625
|
+
* @param {number | null} [value]
|
|
626
|
+
*/
|
|
627
|
+
set maxDepth(value) {
|
|
628
|
+
wasm.wasmconversionoptions_set_maxDepth(this.__wbg_ptr, isLikeNone(value) ? 0x100000001 : (value) >>> 0);
|
|
629
|
+
}
|
|
535
630
|
/**
|
|
536
631
|
* @param {bigint} value
|
|
537
632
|
*/
|
|
@@ -652,7 +747,7 @@ export class WasmConversionOptions {
|
|
|
652
747
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
653
748
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
654
749
|
var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
|
|
655
|
-
wasm.
|
|
750
|
+
wasm.__wbindgen_export4(r0, r1 * 4, 4);
|
|
656
751
|
return v1;
|
|
657
752
|
} finally {
|
|
658
753
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
@@ -674,7 +769,7 @@ export class WasmConversionOptions {
|
|
|
674
769
|
return getStringFromWasm0(r0, r1);
|
|
675
770
|
} finally {
|
|
676
771
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
677
|
-
wasm.
|
|
772
|
+
wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
|
|
678
773
|
}
|
|
679
774
|
}
|
|
680
775
|
/**
|
|
@@ -693,7 +788,7 @@ export class WasmConversionOptions {
|
|
|
693
788
|
return getStringFromWasm0(r0, r1);
|
|
694
789
|
} finally {
|
|
695
790
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
696
|
-
wasm.
|
|
791
|
+
wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
|
|
697
792
|
}
|
|
698
793
|
}
|
|
699
794
|
/**
|
|
@@ -712,7 +807,7 @@ export class WasmConversionOptions {
|
|
|
712
807
|
return getStringFromWasm0(r0, r1);
|
|
713
808
|
} finally {
|
|
714
809
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
715
|
-
wasm.
|
|
810
|
+
wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
|
|
716
811
|
}
|
|
717
812
|
}
|
|
718
813
|
/**
|
|
@@ -739,6 +834,11 @@ export class WasmConversionOptions {
|
|
|
739
834
|
}
|
|
740
835
|
if (Symbol.dispose) WasmConversionOptions.prototype[Symbol.dispose] = WasmConversionOptions.prototype.free;
|
|
741
836
|
|
|
837
|
+
/**
|
|
838
|
+
* Builder for [`ConversionOptions`].
|
|
839
|
+
*
|
|
840
|
+
* All fields start with default values. Call `.build()` to produce the final options.
|
|
841
|
+
*/
|
|
742
842
|
export class WasmConversionOptionsBuilder {
|
|
743
843
|
static __wrap(ptr) {
|
|
744
844
|
ptr = ptr >>> 0;
|
|
@@ -758,6 +858,7 @@ export class WasmConversionOptionsBuilder {
|
|
|
758
858
|
wasm.__wbg_wasmconversionoptionsbuilder_free(ptr, 0);
|
|
759
859
|
}
|
|
760
860
|
/**
|
|
861
|
+
* Build the final [`ConversionOptions`].
|
|
761
862
|
* @returns {WasmConversionOptions}
|
|
762
863
|
*/
|
|
763
864
|
build() {
|
|
@@ -765,6 +866,18 @@ export class WasmConversionOptionsBuilder {
|
|
|
765
866
|
return WasmConversionOptions.__wrap(ret);
|
|
766
867
|
}
|
|
767
868
|
/**
|
|
869
|
+
* Set the list of CSS selectors for elements to exclude entirely from output.
|
|
870
|
+
* @param {string[]} selectors
|
|
871
|
+
* @returns {WasmConversionOptionsBuilder}
|
|
872
|
+
*/
|
|
873
|
+
excludeSelectors(selectors) {
|
|
874
|
+
const ptr0 = passArrayJsValueToWasm0(selectors, wasm.__wbindgen_export);
|
|
875
|
+
const len0 = WASM_VECTOR_LEN;
|
|
876
|
+
const ret = wasm.wasmconversionoptionsbuilder_excludeSelectors(this.__wbg_ptr, ptr0, len0);
|
|
877
|
+
return WasmConversionOptionsBuilder.__wrap(ret);
|
|
878
|
+
}
|
|
879
|
+
/**
|
|
880
|
+
* Set the list of HTML tag names whose `<img>` children are kept inline.
|
|
768
881
|
* @param {string[]} tags
|
|
769
882
|
* @returns {WasmConversionOptionsBuilder}
|
|
770
883
|
*/
|
|
@@ -775,6 +888,7 @@ export class WasmConversionOptionsBuilder {
|
|
|
775
888
|
return WasmConversionOptionsBuilder.__wrap(ret);
|
|
776
889
|
}
|
|
777
890
|
/**
|
|
891
|
+
* Set the pre-processing options applied to the HTML before conversion.
|
|
778
892
|
* @param {WasmPreprocessingOptions} preprocessing
|
|
779
893
|
* @returns {WasmConversionOptionsBuilder}
|
|
780
894
|
*/
|
|
@@ -785,6 +899,7 @@ export class WasmConversionOptionsBuilder {
|
|
|
785
899
|
return WasmConversionOptionsBuilder.__wrap(ret);
|
|
786
900
|
}
|
|
787
901
|
/**
|
|
902
|
+
* Set the list of HTML tag names that are preserved verbatim in output.
|
|
788
903
|
* @param {string[]} tags
|
|
789
904
|
* @returns {WasmConversionOptionsBuilder}
|
|
790
905
|
*/
|
|
@@ -795,6 +910,7 @@ export class WasmConversionOptionsBuilder {
|
|
|
795
910
|
return WasmConversionOptionsBuilder.__wrap(ret);
|
|
796
911
|
}
|
|
797
912
|
/**
|
|
913
|
+
* Set the list of HTML tag names whose content is stripped from output.
|
|
798
914
|
* @param {string[]} tags
|
|
799
915
|
* @returns {WasmConversionOptionsBuilder}
|
|
800
916
|
*/
|
|
@@ -807,6 +923,12 @@ export class WasmConversionOptionsBuilder {
|
|
|
807
923
|
}
|
|
808
924
|
if (Symbol.dispose) WasmConversionOptionsBuilder.prototype[Symbol.dispose] = WasmConversionOptionsBuilder.prototype.free;
|
|
809
925
|
|
|
926
|
+
/**
|
|
927
|
+
* Partial update for `ConversionOptions`.
|
|
928
|
+
*
|
|
929
|
+
* Uses `Option<T>` fields for selective updates. Bindings use this to construct
|
|
930
|
+
* options from language-native types. Prefer [`ConversionOptionsBuilder`] for Rust code.
|
|
931
|
+
*/
|
|
810
932
|
export class WasmConversionOptionsUpdate {
|
|
811
933
|
__destroy_into_raw() {
|
|
812
934
|
const ptr = this.__wbg_ptr;
|
|
@@ -844,7 +966,7 @@ export class WasmConversionOptionsUpdate {
|
|
|
844
966
|
let v1;
|
|
845
967
|
if (r0 !== 0) {
|
|
846
968
|
v1 = getStringFromWasm0(r0, r1).slice();
|
|
847
|
-
wasm.
|
|
969
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
848
970
|
}
|
|
849
971
|
return v1;
|
|
850
972
|
} finally {
|
|
@@ -877,7 +999,7 @@ export class WasmConversionOptionsUpdate {
|
|
|
877
999
|
let v1;
|
|
878
1000
|
if (r0 !== 0) {
|
|
879
1001
|
v1 = getStringFromWasm0(r0, r1).slice();
|
|
880
|
-
wasm.
|
|
1002
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
881
1003
|
}
|
|
882
1004
|
return v1;
|
|
883
1005
|
} finally {
|
|
@@ -917,7 +1039,7 @@ export class WasmConversionOptionsUpdate {
|
|
|
917
1039
|
let v1;
|
|
918
1040
|
if (r0 !== 0) {
|
|
919
1041
|
v1 = getStringFromWasm0(r0, r1).slice();
|
|
920
|
-
wasm.
|
|
1042
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
921
1043
|
}
|
|
922
1044
|
return v1;
|
|
923
1045
|
} finally {
|
|
@@ -952,6 +1074,25 @@ export class WasmConversionOptionsUpdate {
|
|
|
952
1074
|
const ret = wasm.wasmconversionoptionsupdate_escapeUnderscores(this.__wbg_ptr);
|
|
953
1075
|
return ret === 0xFFFFFF ? undefined : ret !== 0;
|
|
954
1076
|
}
|
|
1077
|
+
/**
|
|
1078
|
+
* @returns {string[] | undefined}
|
|
1079
|
+
*/
|
|
1080
|
+
get excludeSelectors() {
|
|
1081
|
+
try {
|
|
1082
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1083
|
+
wasm.wasmconversionoptionsupdate_excludeSelectors(retptr, this.__wbg_ptr);
|
|
1084
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1085
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1086
|
+
let v1;
|
|
1087
|
+
if (r0 !== 0) {
|
|
1088
|
+
v1 = getArrayJsValueFromWasm0(r0, r1).slice();
|
|
1089
|
+
wasm.__wbindgen_export4(r0, r1 * 4, 4);
|
|
1090
|
+
}
|
|
1091
|
+
return v1;
|
|
1092
|
+
} finally {
|
|
1093
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1094
|
+
}
|
|
1095
|
+
}
|
|
955
1096
|
/**
|
|
956
1097
|
* @returns {boolean | undefined}
|
|
957
1098
|
*/
|
|
@@ -1006,7 +1147,7 @@ export class WasmConversionOptionsUpdate {
|
|
|
1006
1147
|
let v1;
|
|
1007
1148
|
if (r0 !== 0) {
|
|
1008
1149
|
v1 = getArrayJsValueFromWasm0(r0, r1).slice();
|
|
1009
|
-
wasm.
|
|
1150
|
+
wasm.__wbindgen_export4(r0, r1 * 4, 4);
|
|
1010
1151
|
}
|
|
1011
1152
|
return v1;
|
|
1012
1153
|
} finally {
|
|
@@ -1034,6 +1175,13 @@ export class WasmConversionOptionsUpdate {
|
|
|
1034
1175
|
const ret = wasm.wasmconversionoptionsupdate_listIndentWidth(this.__wbg_ptr);
|
|
1035
1176
|
return ret === 0x100000001 ? undefined : ret;
|
|
1036
1177
|
}
|
|
1178
|
+
/**
|
|
1179
|
+
* @returns {number | undefined}
|
|
1180
|
+
*/
|
|
1181
|
+
get maxDepth() {
|
|
1182
|
+
const ret = wasm.wasmconversionoptionsupdate_maxDepth(this.__wbg_ptr);
|
|
1183
|
+
return ret === 0x100000001 ? undefined : ret;
|
|
1184
|
+
}
|
|
1037
1185
|
/**
|
|
1038
1186
|
* @returns {bigint | undefined}
|
|
1039
1187
|
*/
|
|
@@ -1087,8 +1235,10 @@ export class WasmConversionOptionsUpdate {
|
|
|
1087
1235
|
* @param {bigint | null} [max_image_size]
|
|
1088
1236
|
* @param {boolean | null} [capture_svg]
|
|
1089
1237
|
* @param {boolean | null} [infer_dimensions]
|
|
1238
|
+
* @param {number | null} [max_depth]
|
|
1239
|
+
* @param {string[] | null} [exclude_selectors]
|
|
1090
1240
|
*/
|
|
1091
|
-
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) {
|
|
1241
|
+
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) {
|
|
1092
1242
|
var ptr0 = isLikeNone(bullets) ? 0 : passStringToWasm0(bullets, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1093
1243
|
var len0 = WASM_VECTOR_LEN;
|
|
1094
1244
|
var ptr1 = isLikeNone(strong_em_symbol) ? 0 : passStringToWasm0(strong_em_symbol, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
@@ -1112,7 +1262,9 @@ export class WasmConversionOptionsUpdate {
|
|
|
1112
1262
|
var len8 = WASM_VECTOR_LEN;
|
|
1113
1263
|
var ptr9 = isLikeNone(preserve_tags) ? 0 : passArrayJsValueToWasm0(preserve_tags, wasm.__wbindgen_export);
|
|
1114
1264
|
var len9 = WASM_VECTOR_LEN;
|
|
1115
|
-
|
|
1265
|
+
var ptr10 = isLikeNone(exclude_selectors) ? 0 : passArrayJsValueToWasm0(exclude_selectors, wasm.__wbindgen_export);
|
|
1266
|
+
var len10 = WASM_VECTOR_LEN;
|
|
1267
|
+
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);
|
|
1116
1268
|
this.__wbg_ptr = ret >>> 0;
|
|
1117
1269
|
WasmConversionOptionsUpdateFinalization.register(this, this.__wbg_ptr, this);
|
|
1118
1270
|
return this;
|
|
@@ -1150,7 +1302,7 @@ export class WasmConversionOptionsUpdate {
|
|
|
1150
1302
|
let v1;
|
|
1151
1303
|
if (r0 !== 0) {
|
|
1152
1304
|
v1 = getArrayJsValueFromWasm0(r0, r1).slice();
|
|
1153
|
-
wasm.
|
|
1305
|
+
wasm.__wbindgen_export4(r0, r1 * 4, 4);
|
|
1154
1306
|
}
|
|
1155
1307
|
return v1;
|
|
1156
1308
|
} finally {
|
|
@@ -1247,6 +1399,14 @@ export class WasmConversionOptionsUpdate {
|
|
|
1247
1399
|
set escapeUnderscores(value) {
|
|
1248
1400
|
wasm.wasmconversionoptionsupdate_set_escapeUnderscores(this.__wbg_ptr, isLikeNone(value) ? 0xFFFFFF : value ? 1 : 0);
|
|
1249
1401
|
}
|
|
1402
|
+
/**
|
|
1403
|
+
* @param {string[] | null} [value]
|
|
1404
|
+
*/
|
|
1405
|
+
set excludeSelectors(value) {
|
|
1406
|
+
var ptr0 = isLikeNone(value) ? 0 : passArrayJsValueToWasm0(value, wasm.__wbindgen_export);
|
|
1407
|
+
var len0 = WASM_VECTOR_LEN;
|
|
1408
|
+
wasm.wasmconversionoptionsupdate_set_excludeSelectors(this.__wbg_ptr, ptr0, len0);
|
|
1409
|
+
}
|
|
1250
1410
|
/**
|
|
1251
1411
|
* @param {boolean | null} [value]
|
|
1252
1412
|
*/
|
|
@@ -1309,6 +1469,12 @@ export class WasmConversionOptionsUpdate {
|
|
|
1309
1469
|
set listIndentWidth(value) {
|
|
1310
1470
|
wasm.wasmconversionoptionsupdate_set_listIndentWidth(this.__wbg_ptr, isLikeNone(value) ? 0x100000001 : (value) >>> 0);
|
|
1311
1471
|
}
|
|
1472
|
+
/**
|
|
1473
|
+
* @param {number | null} [value]
|
|
1474
|
+
*/
|
|
1475
|
+
set maxDepth(value) {
|
|
1476
|
+
wasm.wasmconversionoptionsupdate_set_maxDepth(this.__wbg_ptr, isLikeNone(value) ? 0x100000001 : (value) >>> 0);
|
|
1477
|
+
}
|
|
1312
1478
|
/**
|
|
1313
1479
|
* @param {bigint | null} [value]
|
|
1314
1480
|
*/
|
|
@@ -1434,7 +1600,7 @@ export class WasmConversionOptionsUpdate {
|
|
|
1434
1600
|
let v1;
|
|
1435
1601
|
if (r0 !== 0) {
|
|
1436
1602
|
v1 = getArrayJsValueFromWasm0(r0, r1).slice();
|
|
1437
|
-
wasm.
|
|
1603
|
+
wasm.__wbindgen_export4(r0, r1 * 4, 4);
|
|
1438
1604
|
}
|
|
1439
1605
|
return v1;
|
|
1440
1606
|
} finally {
|
|
@@ -1453,7 +1619,7 @@ export class WasmConversionOptionsUpdate {
|
|
|
1453
1619
|
let v1;
|
|
1454
1620
|
if (r0 !== 0) {
|
|
1455
1621
|
v1 = getStringFromWasm0(r0, r1).slice();
|
|
1456
|
-
wasm.
|
|
1622
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
1457
1623
|
}
|
|
1458
1624
|
return v1;
|
|
1459
1625
|
} finally {
|
|
@@ -1472,7 +1638,7 @@ export class WasmConversionOptionsUpdate {
|
|
|
1472
1638
|
let v1;
|
|
1473
1639
|
if (r0 !== 0) {
|
|
1474
1640
|
v1 = getStringFromWasm0(r0, r1).slice();
|
|
1475
|
-
wasm.
|
|
1641
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
1476
1642
|
}
|
|
1477
1643
|
return v1;
|
|
1478
1644
|
} finally {
|
|
@@ -1491,7 +1657,7 @@ export class WasmConversionOptionsUpdate {
|
|
|
1491
1657
|
let v1;
|
|
1492
1658
|
if (r0 !== 0) {
|
|
1493
1659
|
v1 = getStringFromWasm0(r0, r1).slice();
|
|
1494
|
-
wasm.
|
|
1660
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
1495
1661
|
}
|
|
1496
1662
|
return v1;
|
|
1497
1663
|
} finally {
|
|
@@ -1522,6 +1688,22 @@ export class WasmConversionOptionsUpdate {
|
|
|
1522
1688
|
}
|
|
1523
1689
|
if (Symbol.dispose) WasmConversionOptionsUpdate.prototype[Symbol.dispose] = WasmConversionOptionsUpdate.prototype.free;
|
|
1524
1690
|
|
|
1691
|
+
/**
|
|
1692
|
+
* The primary result of HTML conversion and extraction.
|
|
1693
|
+
*
|
|
1694
|
+
* Contains the converted text output, optional structured document tree,
|
|
1695
|
+
* metadata, extracted tables, images, and processing warnings.
|
|
1696
|
+
*
|
|
1697
|
+
* # Example
|
|
1698
|
+
*
|
|
1699
|
+
* ```text
|
|
1700
|
+
* use html_to_markdown_rs::{convert, ConversionOptions};
|
|
1701
|
+
*
|
|
1702
|
+
* let result = convert("<h1>Hello</h1><p>World</p>", None)?;
|
|
1703
|
+
* assert!(result.content.is_some());
|
|
1704
|
+
* assert!(result.warnings.is_empty());
|
|
1705
|
+
* ```
|
|
1706
|
+
*/
|
|
1525
1707
|
export class WasmConversionResult {
|
|
1526
1708
|
static __wrap(ptr) {
|
|
1527
1709
|
ptr = ptr >>> 0;
|
|
@@ -1552,7 +1734,7 @@ export class WasmConversionResult {
|
|
|
1552
1734
|
let v1;
|
|
1553
1735
|
if (r0 !== 0) {
|
|
1554
1736
|
v1 = getStringFromWasm0(r0, r1).slice();
|
|
1555
|
-
wasm.
|
|
1737
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
1556
1738
|
}
|
|
1557
1739
|
return v1;
|
|
1558
1740
|
} finally {
|
|
@@ -1576,7 +1758,7 @@ export class WasmConversionResult {
|
|
|
1576
1758
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1577
1759
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1578
1760
|
var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
|
|
1579
|
-
wasm.
|
|
1761
|
+
wasm.__wbindgen_export4(r0, r1 * 4, 4);
|
|
1580
1762
|
return v1;
|
|
1581
1763
|
} finally {
|
|
1582
1764
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
@@ -1682,7 +1864,7 @@ export class WasmConversionResult {
|
|
|
1682
1864
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1683
1865
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1684
1866
|
var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
|
|
1685
|
-
wasm.
|
|
1867
|
+
wasm.__wbindgen_export4(r0, r1 * 4, 4);
|
|
1686
1868
|
return v1;
|
|
1687
1869
|
} finally {
|
|
1688
1870
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
@@ -1698,7 +1880,7 @@ export class WasmConversionResult {
|
|
|
1698
1880
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1699
1881
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1700
1882
|
var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
|
|
1701
|
-
wasm.
|
|
1883
|
+
wasm.__wbindgen_export4(r0, r1 * 4, 4);
|
|
1702
1884
|
return v1;
|
|
1703
1885
|
} finally {
|
|
1704
1886
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
@@ -1707,6 +1889,26 @@ export class WasmConversionResult {
|
|
|
1707
1889
|
}
|
|
1708
1890
|
if (Symbol.dispose) WasmConversionResult.prototype[Symbol.dispose] = WasmConversionResult.prototype.free;
|
|
1709
1891
|
|
|
1892
|
+
/**
|
|
1893
|
+
* Document-level metadata extracted from `<head>` and top-level elements.
|
|
1894
|
+
*
|
|
1895
|
+
* Contains all metadata typically used by search engines, social media platforms,
|
|
1896
|
+
* and browsers for document indexing and presentation.
|
|
1897
|
+
*
|
|
1898
|
+
* # Examples
|
|
1899
|
+
*
|
|
1900
|
+
* ```
|
|
1901
|
+
* # use html_to_markdown_rs::metadata::DocumentMetadata;
|
|
1902
|
+
* let doc = DocumentMetadata {
|
|
1903
|
+
* title: Some("My Article".to_string()),
|
|
1904
|
+
* description: Some("A great article about Rust".to_string()),
|
|
1905
|
+
* keywords: vec!["rust".to_string(), "programming".to_string()],
|
|
1906
|
+
* ..Default::default()
|
|
1907
|
+
* };
|
|
1908
|
+
*
|
|
1909
|
+
* assert_eq!(doc.title, Some("My Article".to_string()));
|
|
1910
|
+
* ```
|
|
1911
|
+
*/
|
|
1710
1912
|
export class WasmDocumentMetadata {
|
|
1711
1913
|
static __wrap(ptr) {
|
|
1712
1914
|
ptr = ptr >>> 0;
|
|
@@ -1737,7 +1939,7 @@ export class WasmDocumentMetadata {
|
|
|
1737
1939
|
let v1;
|
|
1738
1940
|
if (r0 !== 0) {
|
|
1739
1941
|
v1 = getStringFromWasm0(r0, r1).slice();
|
|
1740
|
-
wasm.
|
|
1942
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
1741
1943
|
}
|
|
1742
1944
|
return v1;
|
|
1743
1945
|
} finally {
|
|
@@ -1756,7 +1958,7 @@ export class WasmDocumentMetadata {
|
|
|
1756
1958
|
let v1;
|
|
1757
1959
|
if (r0 !== 0) {
|
|
1758
1960
|
v1 = getStringFromWasm0(r0, r1).slice();
|
|
1759
|
-
wasm.
|
|
1961
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
1760
1962
|
}
|
|
1761
1963
|
return v1;
|
|
1762
1964
|
} finally {
|
|
@@ -1775,7 +1977,7 @@ export class WasmDocumentMetadata {
|
|
|
1775
1977
|
let v1;
|
|
1776
1978
|
if (r0 !== 0) {
|
|
1777
1979
|
v1 = getStringFromWasm0(r0, r1).slice();
|
|
1778
|
-
wasm.
|
|
1980
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
1779
1981
|
}
|
|
1780
1982
|
return v1;
|
|
1781
1983
|
} finally {
|
|
@@ -1794,7 +1996,7 @@ export class WasmDocumentMetadata {
|
|
|
1794
1996
|
let v1;
|
|
1795
1997
|
if (r0 !== 0) {
|
|
1796
1998
|
v1 = getStringFromWasm0(r0, r1).slice();
|
|
1797
|
-
wasm.
|
|
1999
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
1798
2000
|
}
|
|
1799
2001
|
return v1;
|
|
1800
2002
|
} finally {
|
|
@@ -1811,7 +2013,7 @@ export class WasmDocumentMetadata {
|
|
|
1811
2013
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1812
2014
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1813
2015
|
var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
|
|
1814
|
-
wasm.
|
|
2016
|
+
wasm.__wbindgen_export4(r0, r1 * 4, 4);
|
|
1815
2017
|
return v1;
|
|
1816
2018
|
} finally {
|
|
1817
2019
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
@@ -1829,7 +2031,7 @@ export class WasmDocumentMetadata {
|
|
|
1829
2031
|
let v1;
|
|
1830
2032
|
if (r0 !== 0) {
|
|
1831
2033
|
v1 = getStringFromWasm0(r0, r1).slice();
|
|
1832
|
-
wasm.
|
|
2034
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
1833
2035
|
}
|
|
1834
2036
|
return v1;
|
|
1835
2037
|
} finally {
|
|
@@ -1982,7 +2184,7 @@ export class WasmDocumentMetadata {
|
|
|
1982
2184
|
let v1;
|
|
1983
2185
|
if (r0 !== 0) {
|
|
1984
2186
|
v1 = getStringFromWasm0(r0, r1).slice();
|
|
1985
|
-
wasm.
|
|
2187
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
1986
2188
|
}
|
|
1987
2189
|
return v1;
|
|
1988
2190
|
} finally {
|
|
@@ -1999,6 +2201,9 @@ export class WasmDocumentMetadata {
|
|
|
1999
2201
|
}
|
|
2000
2202
|
if (Symbol.dispose) WasmDocumentMetadata.prototype[Symbol.dispose] = WasmDocumentMetadata.prototype.free;
|
|
2001
2203
|
|
|
2204
|
+
/**
|
|
2205
|
+
* A single node in the document tree.
|
|
2206
|
+
*/
|
|
2002
2207
|
export class WasmDocumentNode {
|
|
2003
2208
|
static __wrap(ptr) {
|
|
2004
2209
|
ptr = ptr >>> 0;
|
|
@@ -2033,7 +2238,7 @@ export class WasmDocumentNode {
|
|
|
2033
2238
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
2034
2239
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
2035
2240
|
var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
|
|
2036
|
-
wasm.
|
|
2241
|
+
wasm.__wbindgen_export4(r0, r1 * 4, 4);
|
|
2037
2242
|
return v1;
|
|
2038
2243
|
} finally {
|
|
2039
2244
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
@@ -2056,7 +2261,7 @@ export class WasmDocumentNode {
|
|
|
2056
2261
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
2057
2262
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
2058
2263
|
var v1 = getArrayU32FromWasm0(r0, r1).slice();
|
|
2059
|
-
wasm.
|
|
2264
|
+
wasm.__wbindgen_export4(r0, r1 * 4, 4);
|
|
2060
2265
|
return v1;
|
|
2061
2266
|
} finally {
|
|
2062
2267
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
@@ -2085,7 +2290,7 @@ export class WasmDocumentNode {
|
|
|
2085
2290
|
return getStringFromWasm0(r0, r1);
|
|
2086
2291
|
} finally {
|
|
2087
2292
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
2088
|
-
wasm.
|
|
2293
|
+
wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
|
|
2089
2294
|
}
|
|
2090
2295
|
}
|
|
2091
2296
|
/**
|
|
@@ -2160,6 +2365,11 @@ export class WasmDocumentNode {
|
|
|
2160
2365
|
}
|
|
2161
2366
|
if (Symbol.dispose) WasmDocumentNode.prototype[Symbol.dispose] = WasmDocumentNode.prototype.free;
|
|
2162
2367
|
|
|
2368
|
+
/**
|
|
2369
|
+
* A structured document tree representing the semantic content of an HTML document.
|
|
2370
|
+
*
|
|
2371
|
+
* Uses a flat node array with index-based parent/child references for efficient traversal.
|
|
2372
|
+
*/
|
|
2163
2373
|
export class WasmDocumentStructure {
|
|
2164
2374
|
static __wrap(ptr) {
|
|
2165
2375
|
ptr = ptr >>> 0;
|
|
@@ -2202,7 +2412,7 @@ export class WasmDocumentStructure {
|
|
|
2202
2412
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
2203
2413
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
2204
2414
|
var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
|
|
2205
|
-
wasm.
|
|
2415
|
+
wasm.__wbindgen_export4(r0, r1 * 4, 4);
|
|
2206
2416
|
return v1;
|
|
2207
2417
|
} finally {
|
|
2208
2418
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
@@ -2236,7 +2446,7 @@ export class WasmDocumentStructure {
|
|
|
2236
2446
|
let v1;
|
|
2237
2447
|
if (r0 !== 0) {
|
|
2238
2448
|
v1 = getStringFromWasm0(r0, r1).slice();
|
|
2239
|
-
wasm.
|
|
2449
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
2240
2450
|
}
|
|
2241
2451
|
return v1;
|
|
2242
2452
|
} finally {
|
|
@@ -2246,6 +2456,9 @@ export class WasmDocumentStructure {
|
|
|
2246
2456
|
}
|
|
2247
2457
|
if (Symbol.dispose) WasmDocumentStructure.prototype[Symbol.dispose] = WasmDocumentStructure.prototype.free;
|
|
2248
2458
|
|
|
2459
|
+
/**
|
|
2460
|
+
* A single cell in a table grid.
|
|
2461
|
+
*/
|
|
2249
2462
|
export class WasmGridCell {
|
|
2250
2463
|
static __wrap(ptr) {
|
|
2251
2464
|
ptr = ptr >>> 0;
|
|
@@ -2300,7 +2513,7 @@ export class WasmGridCell {
|
|
|
2300
2513
|
return getStringFromWasm0(r0, r1);
|
|
2301
2514
|
} finally {
|
|
2302
2515
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
2303
|
-
wasm.
|
|
2516
|
+
wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
|
|
2304
2517
|
}
|
|
2305
2518
|
}
|
|
2306
2519
|
/**
|
|
@@ -2381,6 +2594,28 @@ export class WasmGridCell {
|
|
|
2381
2594
|
}
|
|
2382
2595
|
if (Symbol.dispose) WasmGridCell.prototype[Symbol.dispose] = WasmGridCell.prototype.free;
|
|
2383
2596
|
|
|
2597
|
+
/**
|
|
2598
|
+
* Header element metadata with hierarchy tracking.
|
|
2599
|
+
*
|
|
2600
|
+
* Captures heading elements (h1-h6) with their text content, identifiers,
|
|
2601
|
+
* and position in the document structure.
|
|
2602
|
+
*
|
|
2603
|
+
* # Examples
|
|
2604
|
+
*
|
|
2605
|
+
* ```
|
|
2606
|
+
* # use html_to_markdown_rs::metadata::HeaderMetadata;
|
|
2607
|
+
* let header = HeaderMetadata {
|
|
2608
|
+
* level: 1,
|
|
2609
|
+
* text: "Main Title".to_string(),
|
|
2610
|
+
* id: Some("main-title".to_string()),
|
|
2611
|
+
* depth: 0,
|
|
2612
|
+
* html_offset: 145,
|
|
2613
|
+
* };
|
|
2614
|
+
*
|
|
2615
|
+
* assert_eq!(header.level, 1);
|
|
2616
|
+
* assert!(header.is_valid());
|
|
2617
|
+
* ```
|
|
2618
|
+
*/
|
|
2384
2619
|
export class WasmHeaderMetadata {
|
|
2385
2620
|
static __wrap(ptr) {
|
|
2386
2621
|
ptr = ptr >>> 0;
|
|
@@ -2431,7 +2666,7 @@ export class WasmHeaderMetadata {
|
|
|
2431
2666
|
let v1;
|
|
2432
2667
|
if (r0 !== 0) {
|
|
2433
2668
|
v1 = getStringFromWasm0(r0, r1).slice();
|
|
2434
|
-
wasm.
|
|
2669
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
2435
2670
|
}
|
|
2436
2671
|
return v1;
|
|
2437
2672
|
} finally {
|
|
@@ -2439,6 +2674,34 @@ export class WasmHeaderMetadata {
|
|
|
2439
2674
|
}
|
|
2440
2675
|
}
|
|
2441
2676
|
/**
|
|
2677
|
+
* Validate that the header level is within valid range (1-6).
|
|
2678
|
+
*
|
|
2679
|
+
* # Returns
|
|
2680
|
+
*
|
|
2681
|
+
* `true` if level is 1-6, `false` otherwise.
|
|
2682
|
+
*
|
|
2683
|
+
* # Examples
|
|
2684
|
+
*
|
|
2685
|
+
* ```
|
|
2686
|
+
* # use html_to_markdown_rs::metadata::HeaderMetadata;
|
|
2687
|
+
* let valid = HeaderMetadata {
|
|
2688
|
+
* level: 3,
|
|
2689
|
+
* text: "Title".to_string(),
|
|
2690
|
+
* id: None,
|
|
2691
|
+
* depth: 2,
|
|
2692
|
+
* html_offset: 100,
|
|
2693
|
+
* };
|
|
2694
|
+
* assert!(valid.is_valid());
|
|
2695
|
+
*
|
|
2696
|
+
* let invalid = HeaderMetadata {
|
|
2697
|
+
* level: 7, // Invalid
|
|
2698
|
+
* text: "Title".to_string(),
|
|
2699
|
+
* id: None,
|
|
2700
|
+
* depth: 2,
|
|
2701
|
+
* html_offset: 100,
|
|
2702
|
+
* };
|
|
2703
|
+
* assert!(!invalid.is_valid());
|
|
2704
|
+
* ```
|
|
2442
2705
|
* @returns {boolean}
|
|
2443
2706
|
*/
|
|
2444
2707
|
isValid() {
|
|
@@ -2519,13 +2782,16 @@ export class WasmHeaderMetadata {
|
|
|
2519
2782
|
return getStringFromWasm0(r0, r1);
|
|
2520
2783
|
} finally {
|
|
2521
2784
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
2522
|
-
wasm.
|
|
2785
|
+
wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
|
|
2523
2786
|
}
|
|
2524
2787
|
}
|
|
2525
2788
|
}
|
|
2526
2789
|
if (Symbol.dispose) WasmHeaderMetadata.prototype[Symbol.dispose] = WasmHeaderMetadata.prototype.free;
|
|
2527
2790
|
|
|
2528
2791
|
/**
|
|
2792
|
+
* Heading style options for Markdown output.
|
|
2793
|
+
*
|
|
2794
|
+
* Controls how headings (h1-h6) are rendered in the output Markdown.
|
|
2529
2795
|
* @enum {0 | 1 | 2}
|
|
2530
2796
|
*/
|
|
2531
2797
|
export const WasmHeadingStyle = Object.freeze({
|
|
@@ -2535,6 +2801,9 @@ export const WasmHeadingStyle = Object.freeze({
|
|
|
2535
2801
|
});
|
|
2536
2802
|
|
|
2537
2803
|
/**
|
|
2804
|
+
* Highlight rendering style for `<mark>` elements.
|
|
2805
|
+
*
|
|
2806
|
+
* Controls how highlighted text is rendered in Markdown output.
|
|
2538
2807
|
* @enum {0 | 1 | 2 | 3}
|
|
2539
2808
|
*/
|
|
2540
2809
|
export const WasmHighlightStyle = Object.freeze({
|
|
@@ -2544,6 +2813,27 @@ export const WasmHighlightStyle = Object.freeze({
|
|
|
2544
2813
|
None: 3, "3": "None",
|
|
2545
2814
|
});
|
|
2546
2815
|
|
|
2816
|
+
/**
|
|
2817
|
+
* Comprehensive metadata extraction result from HTML document.
|
|
2818
|
+
*
|
|
2819
|
+
* Contains all extracted metadata types in a single structure,
|
|
2820
|
+
* suitable for serialization and transmission across language boundaries.
|
|
2821
|
+
*
|
|
2822
|
+
* # Examples
|
|
2823
|
+
*
|
|
2824
|
+
* ```
|
|
2825
|
+
* # use html_to_markdown_rs::metadata::HtmlMetadata;
|
|
2826
|
+
* let metadata = HtmlMetadata {
|
|
2827
|
+
* document: Default::default(),
|
|
2828
|
+
* headers: Vec::new(),
|
|
2829
|
+
* links: Vec::new(),
|
|
2830
|
+
* images: Vec::new(),
|
|
2831
|
+
* structured_data: Vec::new(),
|
|
2832
|
+
* };
|
|
2833
|
+
*
|
|
2834
|
+
* assert!(metadata.headers.is_empty());
|
|
2835
|
+
* ```
|
|
2836
|
+
*/
|
|
2547
2837
|
export class WasmHtmlMetadata {
|
|
2548
2838
|
static __wrap(ptr) {
|
|
2549
2839
|
ptr = ptr >>> 0;
|
|
@@ -2579,7 +2869,7 @@ export class WasmHtmlMetadata {
|
|
|
2579
2869
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
2580
2870
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
2581
2871
|
var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
|
|
2582
|
-
wasm.
|
|
2872
|
+
wasm.__wbindgen_export4(r0, r1 * 4, 4);
|
|
2583
2873
|
return v1;
|
|
2584
2874
|
} finally {
|
|
2585
2875
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
@@ -2595,7 +2885,7 @@ export class WasmHtmlMetadata {
|
|
|
2595
2885
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
2596
2886
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
2597
2887
|
var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
|
|
2598
|
-
wasm.
|
|
2888
|
+
wasm.__wbindgen_export4(r0, r1 * 4, 4);
|
|
2599
2889
|
return v1;
|
|
2600
2890
|
} finally {
|
|
2601
2891
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
@@ -2611,7 +2901,7 @@ export class WasmHtmlMetadata {
|
|
|
2611
2901
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
2612
2902
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
2613
2903
|
var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
|
|
2614
|
-
wasm.
|
|
2904
|
+
wasm.__wbindgen_export4(r0, r1 * 4, 4);
|
|
2615
2905
|
return v1;
|
|
2616
2906
|
} finally {
|
|
2617
2907
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
@@ -2693,7 +2983,7 @@ export class WasmHtmlMetadata {
|
|
|
2693
2983
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
2694
2984
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
2695
2985
|
var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
|
|
2696
|
-
wasm.
|
|
2986
|
+
wasm.__wbindgen_export4(r0, r1 * 4, 4);
|
|
2697
2987
|
return v1;
|
|
2698
2988
|
} finally {
|
|
2699
2989
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
@@ -2702,6 +2992,28 @@ export class WasmHtmlMetadata {
|
|
|
2702
2992
|
}
|
|
2703
2993
|
if (Symbol.dispose) WasmHtmlMetadata.prototype[Symbol.dispose] = WasmHtmlMetadata.prototype.free;
|
|
2704
2994
|
|
|
2995
|
+
/**
|
|
2996
|
+
* Image metadata with source and dimensions.
|
|
2997
|
+
*
|
|
2998
|
+
* Captures `<img>` elements and inline `<svg>` elements with metadata
|
|
2999
|
+
* for image analysis and optimization.
|
|
3000
|
+
*
|
|
3001
|
+
* # Examples
|
|
3002
|
+
*
|
|
3003
|
+
* ```
|
|
3004
|
+
* # use html_to_markdown_rs::metadata::{ImageMetadata, ImageType};
|
|
3005
|
+
* let img = ImageMetadata {
|
|
3006
|
+
* src: "https://example.com/image.jpg".to_string(),
|
|
3007
|
+
* alt: Some("An example image".to_string()),
|
|
3008
|
+
* title: Some("Example".to_string()),
|
|
3009
|
+
* dimensions: Some((800, 600)),
|
|
3010
|
+
* image_type: ImageType::External,
|
|
3011
|
+
* attributes: Default::default(),
|
|
3012
|
+
* };
|
|
3013
|
+
*
|
|
3014
|
+
* assert_eq!(img.image_type, ImageType::External);
|
|
3015
|
+
* ```
|
|
3016
|
+
*/
|
|
2705
3017
|
export class WasmImageMetadata {
|
|
2706
3018
|
static __wrap(ptr) {
|
|
2707
3019
|
ptr = ptr >>> 0;
|
|
@@ -2738,7 +3050,7 @@ export class WasmImageMetadata {
|
|
|
2738
3050
|
let v1;
|
|
2739
3051
|
if (r0 !== 0) {
|
|
2740
3052
|
v1 = getStringFromWasm0(r0, r1).slice();
|
|
2741
|
-
wasm.
|
|
3053
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
2742
3054
|
}
|
|
2743
3055
|
return v1;
|
|
2744
3056
|
} finally {
|
|
@@ -2753,7 +3065,7 @@ export class WasmImageMetadata {
|
|
|
2753
3065
|
return takeObject(ret);
|
|
2754
3066
|
}
|
|
2755
3067
|
/**
|
|
2756
|
-
* @returns {
|
|
3068
|
+
* @returns {Uint32Array | undefined}
|
|
2757
3069
|
*/
|
|
2758
3070
|
get dimensions() {
|
|
2759
3071
|
try {
|
|
@@ -2763,8 +3075,8 @@ export class WasmImageMetadata {
|
|
|
2763
3075
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
2764
3076
|
let v1;
|
|
2765
3077
|
if (r0 !== 0) {
|
|
2766
|
-
v1 =
|
|
2767
|
-
wasm.
|
|
3078
|
+
v1 = getArrayU32FromWasm0(r0, r1).slice();
|
|
3079
|
+
wasm.__wbindgen_export4(r0, r1 * 4, 4);
|
|
2768
3080
|
}
|
|
2769
3081
|
return v1;
|
|
2770
3082
|
} finally {
|
|
@@ -2784,7 +3096,7 @@ export class WasmImageMetadata {
|
|
|
2784
3096
|
* @param {any} attributes
|
|
2785
3097
|
* @param {string | null} [alt]
|
|
2786
3098
|
* @param {string | null} [title]
|
|
2787
|
-
* @param {
|
|
3099
|
+
* @param {Uint32Array | null} [dimensions]
|
|
2788
3100
|
*/
|
|
2789
3101
|
constructor(src, image_type, attributes, alt, title, dimensions) {
|
|
2790
3102
|
const ptr0 = passStringToWasm0(src, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
@@ -2793,7 +3105,7 @@ export class WasmImageMetadata {
|
|
|
2793
3105
|
var len1 = WASM_VECTOR_LEN;
|
|
2794
3106
|
var ptr2 = isLikeNone(title) ? 0 : passStringToWasm0(title, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
2795
3107
|
var len2 = WASM_VECTOR_LEN;
|
|
2796
|
-
var ptr3 = isLikeNone(dimensions) ? 0 :
|
|
3108
|
+
var ptr3 = isLikeNone(dimensions) ? 0 : passArray32ToWasm0(dimensions, wasm.__wbindgen_export);
|
|
2797
3109
|
var len3 = WASM_VECTOR_LEN;
|
|
2798
3110
|
const ret = wasm.wasmimagemetadata_new(ptr0, len0, image_type, addHeapObject(attributes), ptr1, len1, ptr2, len2, ptr3, len3);
|
|
2799
3111
|
this.__wbg_ptr = ret >>> 0;
|
|
@@ -2815,10 +3127,10 @@ export class WasmImageMetadata {
|
|
|
2815
3127
|
wasm.wasmimagemetadata_set_attributes(this.__wbg_ptr, addHeapObject(value));
|
|
2816
3128
|
}
|
|
2817
3129
|
/**
|
|
2818
|
-
* @param {
|
|
3130
|
+
* @param {Uint32Array | null} [value]
|
|
2819
3131
|
*/
|
|
2820
3132
|
set dimensions(value) {
|
|
2821
|
-
var ptr0 = isLikeNone(value) ? 0 :
|
|
3133
|
+
var ptr0 = isLikeNone(value) ? 0 : passArray32ToWasm0(value, wasm.__wbindgen_export);
|
|
2822
3134
|
var len0 = WASM_VECTOR_LEN;
|
|
2823
3135
|
wasm.wasmimagemetadata_set_dimensions(this.__wbg_ptr, ptr0, len0);
|
|
2824
3136
|
}
|
|
@@ -2860,7 +3172,7 @@ export class WasmImageMetadata {
|
|
|
2860
3172
|
return getStringFromWasm0(r0, r1);
|
|
2861
3173
|
} finally {
|
|
2862
3174
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
2863
|
-
wasm.
|
|
3175
|
+
wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
|
|
2864
3176
|
}
|
|
2865
3177
|
}
|
|
2866
3178
|
/**
|
|
@@ -2875,7 +3187,7 @@ export class WasmImageMetadata {
|
|
|
2875
3187
|
let v1;
|
|
2876
3188
|
if (r0 !== 0) {
|
|
2877
3189
|
v1 = getStringFromWasm0(r0, r1).slice();
|
|
2878
|
-
wasm.
|
|
3190
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
2879
3191
|
}
|
|
2880
3192
|
return v1;
|
|
2881
3193
|
} finally {
|
|
@@ -2886,6 +3198,9 @@ export class WasmImageMetadata {
|
|
|
2886
3198
|
if (Symbol.dispose) WasmImageMetadata.prototype[Symbol.dispose] = WasmImageMetadata.prototype.free;
|
|
2887
3199
|
|
|
2888
3200
|
/**
|
|
3201
|
+
* Image source classification for proper handling and processing.
|
|
3202
|
+
*
|
|
3203
|
+
* Determines whether an image is embedded (data URI), inline SVG, external, or relative.
|
|
2889
3204
|
* @enum {0 | 1 | 2 | 3}
|
|
2890
3205
|
*/
|
|
2891
3206
|
export const WasmImageType = Object.freeze({
|
|
@@ -2895,6 +3210,28 @@ export const WasmImageType = Object.freeze({
|
|
|
2895
3210
|
Relative: 3, "3": "Relative",
|
|
2896
3211
|
});
|
|
2897
3212
|
|
|
3213
|
+
/**
|
|
3214
|
+
* Hyperlink metadata with categorization and attributes.
|
|
3215
|
+
*
|
|
3216
|
+
* Represents `<a>` elements with parsed href values, text content, and link type classification.
|
|
3217
|
+
*
|
|
3218
|
+
* # Examples
|
|
3219
|
+
*
|
|
3220
|
+
* ```
|
|
3221
|
+
* # use html_to_markdown_rs::metadata::{LinkMetadata, LinkType};
|
|
3222
|
+
* let link = LinkMetadata {
|
|
3223
|
+
* href: "https://example.com".to_string(),
|
|
3224
|
+
* text: "Example".to_string(),
|
|
3225
|
+
* title: Some("Visit Example".to_string()),
|
|
3226
|
+
* link_type: LinkType::External,
|
|
3227
|
+
* rel: vec!["nofollow".to_string()],
|
|
3228
|
+
* attributes: Default::default(),
|
|
3229
|
+
* };
|
|
3230
|
+
*
|
|
3231
|
+
* assert_eq!(link.link_type, LinkType::External);
|
|
3232
|
+
* assert_eq!(link.text, "Example");
|
|
3233
|
+
* ```
|
|
3234
|
+
*/
|
|
2898
3235
|
export class WasmLinkMetadata {
|
|
2899
3236
|
static __wrap(ptr) {
|
|
2900
3237
|
ptr = ptr >>> 0;
|
|
@@ -2927,6 +3264,25 @@ export class WasmLinkMetadata {
|
|
|
2927
3264
|
return takeObject(ret);
|
|
2928
3265
|
}
|
|
2929
3266
|
/**
|
|
3267
|
+
* Classify a link based on href value.
|
|
3268
|
+
*
|
|
3269
|
+
* # Arguments
|
|
3270
|
+
*
|
|
3271
|
+
* * `href` - The href attribute value
|
|
3272
|
+
*
|
|
3273
|
+
* # Returns
|
|
3274
|
+
*
|
|
3275
|
+
* Appropriate [`LinkType`] based on protocol and content.
|
|
3276
|
+
*
|
|
3277
|
+
* # Examples
|
|
3278
|
+
*
|
|
3279
|
+
* ```
|
|
3280
|
+
* # use html_to_markdown_rs::metadata::{LinkMetadata, LinkType};
|
|
3281
|
+
* assert_eq!(LinkMetadata::classify_link("#section"), LinkType::Anchor);
|
|
3282
|
+
* assert_eq!(LinkMetadata::classify_link("mailto:test@example.com"), LinkType::Email);
|
|
3283
|
+
* assert_eq!(LinkMetadata::classify_link("tel:+1234567890"), LinkType::Phone);
|
|
3284
|
+
* assert_eq!(LinkMetadata::classify_link("https://example.com"), LinkType::External);
|
|
3285
|
+
* ```
|
|
2930
3286
|
* @param {string} href
|
|
2931
3287
|
* @returns {WasmLinkType}
|
|
2932
3288
|
*/
|
|
@@ -2952,7 +3308,7 @@ export class WasmLinkMetadata {
|
|
|
2952
3308
|
return getStringFromWasm0(r0, r1);
|
|
2953
3309
|
} finally {
|
|
2954
3310
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
2955
|
-
wasm.
|
|
3311
|
+
wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
|
|
2956
3312
|
}
|
|
2957
3313
|
}
|
|
2958
3314
|
/**
|
|
@@ -2994,7 +3350,7 @@ export class WasmLinkMetadata {
|
|
|
2994
3350
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
2995
3351
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
2996
3352
|
var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
|
|
2997
|
-
wasm.
|
|
3353
|
+
wasm.__wbindgen_export4(r0, r1 * 4, 4);
|
|
2998
3354
|
return v1;
|
|
2999
3355
|
} finally {
|
|
3000
3356
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
@@ -3060,7 +3416,7 @@ export class WasmLinkMetadata {
|
|
|
3060
3416
|
return getStringFromWasm0(r0, r1);
|
|
3061
3417
|
} finally {
|
|
3062
3418
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
3063
|
-
wasm.
|
|
3419
|
+
wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
|
|
3064
3420
|
}
|
|
3065
3421
|
}
|
|
3066
3422
|
/**
|
|
@@ -3075,7 +3431,7 @@ export class WasmLinkMetadata {
|
|
|
3075
3431
|
let v1;
|
|
3076
3432
|
if (r0 !== 0) {
|
|
3077
3433
|
v1 = getStringFromWasm0(r0, r1).slice();
|
|
3078
|
-
wasm.
|
|
3434
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
3079
3435
|
}
|
|
3080
3436
|
return v1;
|
|
3081
3437
|
} finally {
|
|
@@ -3086,6 +3442,10 @@ export class WasmLinkMetadata {
|
|
|
3086
3442
|
if (Symbol.dispose) WasmLinkMetadata.prototype[Symbol.dispose] = WasmLinkMetadata.prototype.free;
|
|
3087
3443
|
|
|
3088
3444
|
/**
|
|
3445
|
+
* Link rendering style in Markdown output.
|
|
3446
|
+
*
|
|
3447
|
+
* Controls whether links and images use inline `[text](url)` syntax or
|
|
3448
|
+
* reference-style `[text][1]` syntax with definitions collected at the end.
|
|
3089
3449
|
* @enum {0 | 1}
|
|
3090
3450
|
*/
|
|
3091
3451
|
export const WasmLinkStyle = Object.freeze({
|
|
@@ -3094,6 +3454,9 @@ export const WasmLinkStyle = Object.freeze({
|
|
|
3094
3454
|
});
|
|
3095
3455
|
|
|
3096
3456
|
/**
|
|
3457
|
+
* Link classification based on href value and document context.
|
|
3458
|
+
*
|
|
3459
|
+
* Used to categorize links during extraction for filtering and analysis.
|
|
3097
3460
|
* @enum {0 | 1 | 2 | 3 | 4 | 5}
|
|
3098
3461
|
*/
|
|
3099
3462
|
export const WasmLinkType = Object.freeze({
|
|
@@ -3106,6 +3469,9 @@ export const WasmLinkType = Object.freeze({
|
|
|
3106
3469
|
});
|
|
3107
3470
|
|
|
3108
3471
|
/**
|
|
3472
|
+
* List indentation character type.
|
|
3473
|
+
*
|
|
3474
|
+
* Controls whether list items are indented with spaces or tabs.
|
|
3109
3475
|
* @enum {0 | 1}
|
|
3110
3476
|
*/
|
|
3111
3477
|
export const WasmListIndentType = Object.freeze({
|
|
@@ -3113,267 +3479,299 @@ export const WasmListIndentType = Object.freeze({
|
|
|
3113
3479
|
Tabs: 1, "1": "Tabs",
|
|
3114
3480
|
});
|
|
3115
3481
|
|
|
3116
|
-
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
|
|
3121
|
-
|
|
3122
|
-
|
|
3123
|
-
|
|
3482
|
+
/**
|
|
3483
|
+
* Line break syntax in Markdown output.
|
|
3484
|
+
*
|
|
3485
|
+
* Controls how soft line breaks (from `<br>` or line breaks in source) are rendered.
|
|
3486
|
+
* @enum {0 | 1}
|
|
3487
|
+
*/
|
|
3488
|
+
export const WasmNewlineStyle = Object.freeze({
|
|
3489
|
+
Spaces: 0, "0": "Spaces",
|
|
3490
|
+
Backslash: 1, "1": "Backslash",
|
|
3491
|
+
});
|
|
3492
|
+
|
|
3493
|
+
/**
|
|
3494
|
+
* The semantic content type of a document node.
|
|
3495
|
+
*
|
|
3496
|
+
* Uses internally tagged representation (`"node_type": "heading"`) for JSON serialization.
|
|
3497
|
+
* @enum {0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12}
|
|
3498
|
+
*/
|
|
3499
|
+
export const WasmNodeContent = Object.freeze({
|
|
3500
|
+
Heading: 0, "0": "Heading",
|
|
3501
|
+
Paragraph: 1, "1": "Paragraph",
|
|
3502
|
+
List: 2, "2": "List",
|
|
3503
|
+
ListItem: 3, "3": "ListItem",
|
|
3504
|
+
Table: 4, "4": "Table",
|
|
3505
|
+
Image: 5, "5": "Image",
|
|
3506
|
+
Code: 6, "6": "Code",
|
|
3507
|
+
Quote: 7, "7": "Quote",
|
|
3508
|
+
DefinitionList: 8, "8": "DefinitionList",
|
|
3509
|
+
DefinitionItem: 9, "9": "DefinitionItem",
|
|
3510
|
+
RawBlock: 10, "10": "RawBlock",
|
|
3511
|
+
MetadataBlock: 11, "11": "MetadataBlock",
|
|
3512
|
+
Group: 12, "12": "Group",
|
|
3513
|
+
});
|
|
3514
|
+
|
|
3515
|
+
/**
|
|
3516
|
+
* Context information passed to all visitor methods.
|
|
3517
|
+
*
|
|
3518
|
+
* Provides comprehensive metadata about the current node being visited,
|
|
3519
|
+
* including its type, attributes, position in the DOM tree, and parent context.
|
|
3520
|
+
*/
|
|
3521
|
+
export class WasmNodeContext {
|
|
3124
3522
|
__destroy_into_raw() {
|
|
3125
3523
|
const ptr = this.__wbg_ptr;
|
|
3126
3524
|
this.__wbg_ptr = 0;
|
|
3127
|
-
|
|
3525
|
+
WasmNodeContextFinalization.unregister(this);
|
|
3128
3526
|
return ptr;
|
|
3129
3527
|
}
|
|
3130
3528
|
free() {
|
|
3131
3529
|
const ptr = this.__destroy_into_raw();
|
|
3132
|
-
wasm.
|
|
3133
|
-
}
|
|
3134
|
-
/**
|
|
3135
|
-
* @returns {boolean}
|
|
3136
|
-
*/
|
|
3137
|
-
anyEnabled() {
|
|
3138
|
-
const ret = wasm.wasmmetadataconfig_anyEnabled(this.__wbg_ptr);
|
|
3139
|
-
return ret !== 0;
|
|
3530
|
+
wasm.__wbg_wasmnodecontext_free(ptr, 0);
|
|
3140
3531
|
}
|
|
3141
3532
|
/**
|
|
3142
|
-
* @returns {
|
|
3143
|
-
*/
|
|
3144
|
-
static default() {
|
|
3145
|
-
const ret = wasm.wasmmetadataconfig_default();
|
|
3146
|
-
return WasmMetadataConfig.__wrap(ret);
|
|
3147
|
-
}
|
|
3148
|
-
/**
|
|
3149
|
-
* @returns {boolean}
|
|
3150
|
-
*/
|
|
3151
|
-
get extractDocument() {
|
|
3152
|
-
const ret = wasm.wasmmetadataconfig_extractDocument(this.__wbg_ptr);
|
|
3153
|
-
return ret !== 0;
|
|
3154
|
-
}
|
|
3155
|
-
/**
|
|
3156
|
-
* @returns {boolean}
|
|
3533
|
+
* @returns {WasmConversionResult}
|
|
3157
3534
|
*/
|
|
3158
|
-
get
|
|
3159
|
-
const ret = wasm.
|
|
3160
|
-
return ret
|
|
3535
|
+
get attributes() {
|
|
3536
|
+
const ret = wasm.wasmnodecontext_attributes(this.__wbg_ptr);
|
|
3537
|
+
return takeObject(ret);
|
|
3161
3538
|
}
|
|
3162
3539
|
/**
|
|
3163
|
-
* @returns {
|
|
3540
|
+
* @returns {number}
|
|
3164
3541
|
*/
|
|
3165
|
-
get
|
|
3166
|
-
const ret = wasm.
|
|
3167
|
-
return ret
|
|
3542
|
+
get depth() {
|
|
3543
|
+
const ret = wasm.wasmnodecontext_depth(this.__wbg_ptr);
|
|
3544
|
+
return ret >>> 0;
|
|
3168
3545
|
}
|
|
3169
3546
|
/**
|
|
3170
|
-
* @returns {
|
|
3547
|
+
* @returns {number}
|
|
3171
3548
|
*/
|
|
3172
|
-
get
|
|
3173
|
-
const ret = wasm.
|
|
3174
|
-
return ret
|
|
3549
|
+
get indexInParent() {
|
|
3550
|
+
const ret = wasm.wasmnodecontext_indexInParent(this.__wbg_ptr);
|
|
3551
|
+
return ret >>> 0;
|
|
3175
3552
|
}
|
|
3176
3553
|
/**
|
|
3177
3554
|
* @returns {boolean}
|
|
3178
3555
|
*/
|
|
3179
|
-
get
|
|
3180
|
-
const ret = wasm.
|
|
3556
|
+
get isInline() {
|
|
3557
|
+
const ret = wasm.wasmnodecontext_isInline(this.__wbg_ptr);
|
|
3181
3558
|
return ret !== 0;
|
|
3182
3559
|
}
|
|
3183
3560
|
/**
|
|
3184
|
-
* @
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
|
|
3188
|
-
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
* @param {boolean | null} [extract_document]
|
|
3192
|
-
* @param {boolean | null} [extract_headers]
|
|
3193
|
-
* @param {boolean | null} [extract_links]
|
|
3194
|
-
* @param {boolean | null} [extract_images]
|
|
3195
|
-
* @param {boolean | null} [extract_structured_data]
|
|
3196
|
-
* @param {number | null} [max_structured_data_size]
|
|
3561
|
+
* @param {WasmNodeType} node_type
|
|
3562
|
+
* @param {string} tag_name
|
|
3563
|
+
* @param {any} attributes
|
|
3564
|
+
* @param {number} depth
|
|
3565
|
+
* @param {number} index_in_parent
|
|
3566
|
+
* @param {boolean} is_inline
|
|
3567
|
+
* @param {string | null} [parent_tag]
|
|
3197
3568
|
*/
|
|
3198
|
-
constructor(
|
|
3199
|
-
const
|
|
3569
|
+
constructor(node_type, tag_name, attributes, depth, index_in_parent, is_inline, parent_tag) {
|
|
3570
|
+
const ptr0 = passStringToWasm0(tag_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
3571
|
+
const len0 = WASM_VECTOR_LEN;
|
|
3572
|
+
var ptr1 = isLikeNone(parent_tag) ? 0 : passStringToWasm0(parent_tag, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
3573
|
+
var len1 = WASM_VECTOR_LEN;
|
|
3574
|
+
const ret = wasm.wasmnodecontext_new(node_type, ptr0, len0, addHeapObject(attributes), depth, index_in_parent, is_inline, ptr1, len1);
|
|
3200
3575
|
this.__wbg_ptr = ret >>> 0;
|
|
3201
|
-
|
|
3576
|
+
WasmNodeContextFinalization.register(this, this.__wbg_ptr, this);
|
|
3202
3577
|
return this;
|
|
3203
3578
|
}
|
|
3204
3579
|
/**
|
|
3205
|
-
* @
|
|
3206
|
-
*/
|
|
3207
|
-
set extractDocument(value) {
|
|
3208
|
-
wasm.wasmmetadataconfig_set_extractDocument(this.__wbg_ptr, value);
|
|
3209
|
-
}
|
|
3210
|
-
/**
|
|
3211
|
-
* @param {boolean} value
|
|
3212
|
-
*/
|
|
3213
|
-
set extractHeaders(value) {
|
|
3214
|
-
wasm.wasmmetadataconfig_set_extractHeaders(this.__wbg_ptr, value);
|
|
3215
|
-
}
|
|
3216
|
-
/**
|
|
3217
|
-
* @param {boolean} value
|
|
3580
|
+
* @returns {WasmNodeType}
|
|
3218
3581
|
*/
|
|
3219
|
-
|
|
3220
|
-
wasm.
|
|
3582
|
+
get nodeType() {
|
|
3583
|
+
const ret = wasm.wasmnodecontext_nodeType(this.__wbg_ptr);
|
|
3584
|
+
return ret;
|
|
3221
3585
|
}
|
|
3222
3586
|
/**
|
|
3223
|
-
* @
|
|
3587
|
+
* @returns {string | undefined}
|
|
3224
3588
|
*/
|
|
3225
|
-
|
|
3226
|
-
|
|
3589
|
+
get parentTag() {
|
|
3590
|
+
try {
|
|
3591
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
3592
|
+
wasm.wasmnodecontext_parentTag(retptr, this.__wbg_ptr);
|
|
3593
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
3594
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
3595
|
+
let v1;
|
|
3596
|
+
if (r0 !== 0) {
|
|
3597
|
+
v1 = getStringFromWasm0(r0, r1).slice();
|
|
3598
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
3599
|
+
}
|
|
3600
|
+
return v1;
|
|
3601
|
+
} finally {
|
|
3602
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
3603
|
+
}
|
|
3227
3604
|
}
|
|
3228
3605
|
/**
|
|
3229
|
-
* @param {
|
|
3606
|
+
* @param {any} value
|
|
3230
3607
|
*/
|
|
3231
|
-
set
|
|
3232
|
-
wasm.
|
|
3608
|
+
set attributes(value) {
|
|
3609
|
+
wasm.wasmnodecontext_set_attributes(this.__wbg_ptr, addHeapObject(value));
|
|
3233
3610
|
}
|
|
3234
3611
|
/**
|
|
3235
3612
|
* @param {number} value
|
|
3236
3613
|
*/
|
|
3237
|
-
set
|
|
3238
|
-
wasm.
|
|
3239
|
-
}
|
|
3240
|
-
}
|
|
3241
|
-
if (Symbol.dispose) WasmMetadataConfig.prototype[Symbol.dispose] = WasmMetadataConfig.prototype.free;
|
|
3242
|
-
|
|
3243
|
-
export class WasmMetadataConfigUpdate {
|
|
3244
|
-
__destroy_into_raw() {
|
|
3245
|
-
const ptr = this.__wbg_ptr;
|
|
3246
|
-
this.__wbg_ptr = 0;
|
|
3247
|
-
WasmMetadataConfigUpdateFinalization.unregister(this);
|
|
3248
|
-
return ptr;
|
|
3249
|
-
}
|
|
3250
|
-
free() {
|
|
3251
|
-
const ptr = this.__destroy_into_raw();
|
|
3252
|
-
wasm.__wbg_wasmmetadataconfigupdate_free(ptr, 0);
|
|
3253
|
-
}
|
|
3254
|
-
/**
|
|
3255
|
-
* @returns {boolean | undefined}
|
|
3256
|
-
*/
|
|
3257
|
-
get extractDocument() {
|
|
3258
|
-
const ret = wasm.wasmmetadataconfigupdate_extractDocument(this.__wbg_ptr);
|
|
3259
|
-
return ret === 0xFFFFFF ? undefined : ret !== 0;
|
|
3260
|
-
}
|
|
3261
|
-
/**
|
|
3262
|
-
* @returns {boolean | undefined}
|
|
3263
|
-
*/
|
|
3264
|
-
get extractHeaders() {
|
|
3265
|
-
const ret = wasm.wasmmetadataconfigupdate_extractHeaders(this.__wbg_ptr);
|
|
3266
|
-
return ret === 0xFFFFFF ? undefined : ret !== 0;
|
|
3267
|
-
}
|
|
3268
|
-
/**
|
|
3269
|
-
* @returns {boolean | undefined}
|
|
3270
|
-
*/
|
|
3271
|
-
get extractImages() {
|
|
3272
|
-
const ret = wasm.wasmmetadataconfigupdate_extractImages(this.__wbg_ptr);
|
|
3273
|
-
return ret === 0xFFFFFF ? undefined : ret !== 0;
|
|
3274
|
-
}
|
|
3275
|
-
/**
|
|
3276
|
-
* @returns {boolean | undefined}
|
|
3277
|
-
*/
|
|
3278
|
-
get extractLinks() {
|
|
3279
|
-
const ret = wasm.wasmmetadataconfigupdate_extractLinks(this.__wbg_ptr);
|
|
3280
|
-
return ret === 0xFFFFFF ? undefined : ret !== 0;
|
|
3281
|
-
}
|
|
3282
|
-
/**
|
|
3283
|
-
* @returns {boolean | undefined}
|
|
3284
|
-
*/
|
|
3285
|
-
get extractStructuredData() {
|
|
3286
|
-
const ret = wasm.wasmmetadataconfigupdate_extractStructuredData(this.__wbg_ptr);
|
|
3287
|
-
return ret === 0xFFFFFF ? undefined : ret !== 0;
|
|
3288
|
-
}
|
|
3289
|
-
/**
|
|
3290
|
-
* @returns {number | undefined}
|
|
3291
|
-
*/
|
|
3292
|
-
get maxStructuredDataSize() {
|
|
3293
|
-
const ret = wasm.wasmmetadataconfigupdate_maxStructuredDataSize(this.__wbg_ptr);
|
|
3294
|
-
return ret === 0x100000001 ? undefined : ret;
|
|
3295
|
-
}
|
|
3296
|
-
/**
|
|
3297
|
-
* @param {boolean | null} [extract_document]
|
|
3298
|
-
* @param {boolean | null} [extract_headers]
|
|
3299
|
-
* @param {boolean | null} [extract_links]
|
|
3300
|
-
* @param {boolean | null} [extract_images]
|
|
3301
|
-
* @param {boolean | null} [extract_structured_data]
|
|
3302
|
-
* @param {number | null} [max_structured_data_size]
|
|
3303
|
-
*/
|
|
3304
|
-
constructor(extract_document, extract_headers, extract_links, extract_images, extract_structured_data, max_structured_data_size) {
|
|
3305
|
-
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);
|
|
3306
|
-
this.__wbg_ptr = ret >>> 0;
|
|
3307
|
-
WasmMetadataConfigUpdateFinalization.register(this, this.__wbg_ptr, this);
|
|
3308
|
-
return this;
|
|
3614
|
+
set depth(value) {
|
|
3615
|
+
wasm.wasmnodecontext_set_depth(this.__wbg_ptr, value);
|
|
3309
3616
|
}
|
|
3310
3617
|
/**
|
|
3311
|
-
* @param {
|
|
3618
|
+
* @param {number} value
|
|
3312
3619
|
*/
|
|
3313
|
-
set
|
|
3314
|
-
wasm.
|
|
3620
|
+
set indexInParent(value) {
|
|
3621
|
+
wasm.wasmnodecontext_set_indexInParent(this.__wbg_ptr, value);
|
|
3315
3622
|
}
|
|
3316
3623
|
/**
|
|
3317
|
-
* @param {boolean
|
|
3624
|
+
* @param {boolean} value
|
|
3318
3625
|
*/
|
|
3319
|
-
set
|
|
3320
|
-
wasm.
|
|
3626
|
+
set isInline(value) {
|
|
3627
|
+
wasm.wasmnodecontext_set_isInline(this.__wbg_ptr, value);
|
|
3321
3628
|
}
|
|
3322
3629
|
/**
|
|
3323
|
-
* @param {
|
|
3630
|
+
* @param {WasmNodeType} value
|
|
3324
3631
|
*/
|
|
3325
|
-
set
|
|
3326
|
-
wasm.
|
|
3632
|
+
set nodeType(value) {
|
|
3633
|
+
wasm.wasmnodecontext_set_nodeType(this.__wbg_ptr, value);
|
|
3327
3634
|
}
|
|
3328
3635
|
/**
|
|
3329
|
-
* @param {
|
|
3636
|
+
* @param {string | null} [value]
|
|
3330
3637
|
*/
|
|
3331
|
-
set
|
|
3332
|
-
|
|
3638
|
+
set parentTag(value) {
|
|
3639
|
+
var ptr0 = isLikeNone(value) ? 0 : passStringToWasm0(value, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
3640
|
+
var len0 = WASM_VECTOR_LEN;
|
|
3641
|
+
wasm.wasmnodecontext_set_parentTag(this.__wbg_ptr, ptr0, len0);
|
|
3333
3642
|
}
|
|
3334
3643
|
/**
|
|
3335
|
-
* @param {
|
|
3644
|
+
* @param {string} value
|
|
3336
3645
|
*/
|
|
3337
|
-
set
|
|
3338
|
-
|
|
3646
|
+
set tagName(value) {
|
|
3647
|
+
const ptr0 = passStringToWasm0(value, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
3648
|
+
const len0 = WASM_VECTOR_LEN;
|
|
3649
|
+
wasm.wasmnodecontext_set_tagName(this.__wbg_ptr, ptr0, len0);
|
|
3339
3650
|
}
|
|
3340
3651
|
/**
|
|
3341
|
-
* @
|
|
3652
|
+
* @returns {string}
|
|
3342
3653
|
*/
|
|
3343
|
-
|
|
3344
|
-
|
|
3654
|
+
get tagName() {
|
|
3655
|
+
let deferred1_0;
|
|
3656
|
+
let deferred1_1;
|
|
3657
|
+
try {
|
|
3658
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
3659
|
+
wasm.wasmnodecontext_tagName(retptr, this.__wbg_ptr);
|
|
3660
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
3661
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
3662
|
+
deferred1_0 = r0;
|
|
3663
|
+
deferred1_1 = r1;
|
|
3664
|
+
return getStringFromWasm0(r0, r1);
|
|
3665
|
+
} finally {
|
|
3666
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
3667
|
+
wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
|
|
3668
|
+
}
|
|
3345
3669
|
}
|
|
3346
3670
|
}
|
|
3347
|
-
if (Symbol.dispose)
|
|
3348
|
-
|
|
3349
|
-
/**
|
|
3350
|
-
* @enum {0 | 1}
|
|
3351
|
-
*/
|
|
3352
|
-
export const WasmNewlineStyle = Object.freeze({
|
|
3353
|
-
Spaces: 0, "0": "Spaces",
|
|
3354
|
-
Backslash: 1, "1": "Backslash",
|
|
3355
|
-
});
|
|
3671
|
+
if (Symbol.dispose) WasmNodeContext.prototype[Symbol.dispose] = WasmNodeContext.prototype.free;
|
|
3356
3672
|
|
|
3357
3673
|
/**
|
|
3358
|
-
*
|
|
3674
|
+
* Node type enumeration covering all HTML element types.
|
|
3675
|
+
*
|
|
3676
|
+
* This enum categorizes all HTML elements that the converter recognizes,
|
|
3677
|
+
* providing a coarse-grained classification for visitor dispatch.
|
|
3678
|
+
* @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}
|
|
3359
3679
|
*/
|
|
3360
|
-
export const
|
|
3361
|
-
|
|
3362
|
-
|
|
3363
|
-
|
|
3364
|
-
|
|
3365
|
-
|
|
3366
|
-
|
|
3367
|
-
|
|
3368
|
-
|
|
3369
|
-
|
|
3370
|
-
|
|
3371
|
-
|
|
3372
|
-
|
|
3373
|
-
|
|
3680
|
+
export const WasmNodeType = Object.freeze({
|
|
3681
|
+
Text: 0, "0": "Text",
|
|
3682
|
+
Element: 1, "1": "Element",
|
|
3683
|
+
Heading: 2, "2": "Heading",
|
|
3684
|
+
Paragraph: 3, "3": "Paragraph",
|
|
3685
|
+
Div: 4, "4": "Div",
|
|
3686
|
+
Blockquote: 5, "5": "Blockquote",
|
|
3687
|
+
Pre: 6, "6": "Pre",
|
|
3688
|
+
Hr: 7, "7": "Hr",
|
|
3689
|
+
List: 8, "8": "List",
|
|
3690
|
+
ListItem: 9, "9": "ListItem",
|
|
3691
|
+
DefinitionList: 10, "10": "DefinitionList",
|
|
3692
|
+
DefinitionTerm: 11, "11": "DefinitionTerm",
|
|
3693
|
+
DefinitionDescription: 12, "12": "DefinitionDescription",
|
|
3694
|
+
Table: 13, "13": "Table",
|
|
3695
|
+
TableRow: 14, "14": "TableRow",
|
|
3696
|
+
TableCell: 15, "15": "TableCell",
|
|
3697
|
+
TableHeader: 16, "16": "TableHeader",
|
|
3698
|
+
TableBody: 17, "17": "TableBody",
|
|
3699
|
+
TableHead: 18, "18": "TableHead",
|
|
3700
|
+
TableFoot: 19, "19": "TableFoot",
|
|
3701
|
+
Link: 20, "20": "Link",
|
|
3702
|
+
Image: 21, "21": "Image",
|
|
3703
|
+
Strong: 22, "22": "Strong",
|
|
3704
|
+
Em: 23, "23": "Em",
|
|
3705
|
+
Code: 24, "24": "Code",
|
|
3706
|
+
Strikethrough: 25, "25": "Strikethrough",
|
|
3707
|
+
Underline: 26, "26": "Underline",
|
|
3708
|
+
Subscript: 27, "27": "Subscript",
|
|
3709
|
+
Superscript: 28, "28": "Superscript",
|
|
3710
|
+
Mark: 29, "29": "Mark",
|
|
3711
|
+
Small: 30, "30": "Small",
|
|
3712
|
+
Br: 31, "31": "Br",
|
|
3713
|
+
Span: 32, "32": "Span",
|
|
3714
|
+
Article: 33, "33": "Article",
|
|
3715
|
+
Section: 34, "34": "Section",
|
|
3716
|
+
Nav: 35, "35": "Nav",
|
|
3717
|
+
Aside: 36, "36": "Aside",
|
|
3718
|
+
Header: 37, "37": "Header",
|
|
3719
|
+
Footer: 38, "38": "Footer",
|
|
3720
|
+
Main: 39, "39": "Main",
|
|
3721
|
+
Figure: 40, "40": "Figure",
|
|
3722
|
+
Figcaption: 41, "41": "Figcaption",
|
|
3723
|
+
Time: 42, "42": "Time",
|
|
3724
|
+
Details: 43, "43": "Details",
|
|
3725
|
+
Summary: 44, "44": "Summary",
|
|
3726
|
+
Form: 45, "45": "Form",
|
|
3727
|
+
Input: 46, "46": "Input",
|
|
3728
|
+
Select: 47, "47": "Select",
|
|
3729
|
+
Option: 48, "48": "Option",
|
|
3730
|
+
Button: 49, "49": "Button",
|
|
3731
|
+
Textarea: 50, "50": "Textarea",
|
|
3732
|
+
Label: 51, "51": "Label",
|
|
3733
|
+
Fieldset: 52, "52": "Fieldset",
|
|
3734
|
+
Legend: 53, "53": "Legend",
|
|
3735
|
+
Audio: 54, "54": "Audio",
|
|
3736
|
+
Video: 55, "55": "Video",
|
|
3737
|
+
Picture: 56, "56": "Picture",
|
|
3738
|
+
Source: 57, "57": "Source",
|
|
3739
|
+
Iframe: 58, "58": "Iframe",
|
|
3740
|
+
Svg: 59, "59": "Svg",
|
|
3741
|
+
Canvas: 60, "60": "Canvas",
|
|
3742
|
+
Ruby: 61, "61": "Ruby",
|
|
3743
|
+
Rt: 62, "62": "Rt",
|
|
3744
|
+
Rp: 63, "63": "Rp",
|
|
3745
|
+
Abbr: 64, "64": "Abbr",
|
|
3746
|
+
Kbd: 65, "65": "Kbd",
|
|
3747
|
+
Samp: 66, "66": "Samp",
|
|
3748
|
+
Var: 67, "67": "Var",
|
|
3749
|
+
Cite: 68, "68": "Cite",
|
|
3750
|
+
Q: 69, "69": "Q",
|
|
3751
|
+
Del: 70, "70": "Del",
|
|
3752
|
+
Ins: 71, "71": "Ins",
|
|
3753
|
+
Data: 72, "72": "Data",
|
|
3754
|
+
Meter: 73, "73": "Meter",
|
|
3755
|
+
Progress: 74, "74": "Progress",
|
|
3756
|
+
Output: 75, "75": "Output",
|
|
3757
|
+
Template: 76, "76": "Template",
|
|
3758
|
+
Slot: 77, "77": "Slot",
|
|
3759
|
+
Html: 78, "78": "Html",
|
|
3760
|
+
Head: 79, "79": "Head",
|
|
3761
|
+
Body: 80, "80": "Body",
|
|
3762
|
+
Title: 81, "81": "Title",
|
|
3763
|
+
Meta: 82, "82": "Meta",
|
|
3764
|
+
LinkTag: 83, "83": "LinkTag",
|
|
3765
|
+
Style: 84, "84": "Style",
|
|
3766
|
+
Script: 85, "85": "Script",
|
|
3767
|
+
Base: 86, "86": "Base",
|
|
3768
|
+
Custom: 87, "87": "Custom",
|
|
3374
3769
|
});
|
|
3375
3770
|
|
|
3376
3771
|
/**
|
|
3772
|
+
* Output format for conversion.
|
|
3773
|
+
*
|
|
3774
|
+
* Specifies the target markup language format for the conversion output.
|
|
3377
3775
|
* @enum {0 | 1 | 2}
|
|
3378
3776
|
*/
|
|
3379
3777
|
export const WasmOutputFormat = Object.freeze({
|
|
@@ -3382,6 +3780,9 @@ export const WasmOutputFormat = Object.freeze({
|
|
|
3382
3780
|
Plain: 2, "2": "Plain",
|
|
3383
3781
|
});
|
|
3384
3782
|
|
|
3783
|
+
/**
|
|
3784
|
+
* HTML preprocessing options for document cleanup before conversion.
|
|
3785
|
+
*/
|
|
3385
3786
|
export class WasmPreprocessingOptions {
|
|
3386
3787
|
static __wrap(ptr) {
|
|
3387
3788
|
ptr = ptr >>> 0;
|
|
@@ -3400,6 +3801,22 @@ export class WasmPreprocessingOptions {
|
|
|
3400
3801
|
const ptr = this.__destroy_into_raw();
|
|
3401
3802
|
wasm.__wbg_wasmpreprocessingoptions_free(ptr, 0);
|
|
3402
3803
|
}
|
|
3804
|
+
/**
|
|
3805
|
+
* Apply a partial update to these preprocessing options.
|
|
3806
|
+
*
|
|
3807
|
+
* Any specified fields in the update will override the current values.
|
|
3808
|
+
* Unspecified fields (None) are left unchanged.
|
|
3809
|
+
*
|
|
3810
|
+
* # Arguments
|
|
3811
|
+
*
|
|
3812
|
+
* * `update` - Partial preprocessing options update
|
|
3813
|
+
* @param {WasmPreprocessingOptionsUpdate} _update
|
|
3814
|
+
*/
|
|
3815
|
+
applyUpdate(_update) {
|
|
3816
|
+
_assertClass(_update, WasmPreprocessingOptionsUpdate);
|
|
3817
|
+
var ptr0 = _update.__destroy_into_raw();
|
|
3818
|
+
wasm.wasmpreprocessingoptions_applyUpdate(this.__wbg_ptr, ptr0);
|
|
3819
|
+
}
|
|
3403
3820
|
/**
|
|
3404
3821
|
* @returns {WasmPreprocessingOptions}
|
|
3405
3822
|
*/
|
|
@@ -3414,6 +3831,38 @@ export class WasmPreprocessingOptions {
|
|
|
3414
3831
|
const ret = wasm.wasmpreprocessingoptions_enabled(this.__wbg_ptr);
|
|
3415
3832
|
return ret !== 0;
|
|
3416
3833
|
}
|
|
3834
|
+
/**
|
|
3835
|
+
* @param {WasmPreprocessingOptionsUpdate} update
|
|
3836
|
+
* @returns {WasmPreprocessingOptions}
|
|
3837
|
+
*/
|
|
3838
|
+
static from(update) {
|
|
3839
|
+
_assertClass(update, WasmPreprocessingOptionsUpdate);
|
|
3840
|
+
var ptr0 = update.__destroy_into_raw();
|
|
3841
|
+
const ret = wasm.wasmpreprocessingoptions_from(ptr0);
|
|
3842
|
+
return WasmPreprocessingOptions.__wrap(ret);
|
|
3843
|
+
}
|
|
3844
|
+
/**
|
|
3845
|
+
* Create new preprocessing options from a partial update.
|
|
3846
|
+
*
|
|
3847
|
+
* Creates a new `PreprocessingOptions` struct with defaults, then applies the update.
|
|
3848
|
+
* Fields not specified in the update keep their default values.
|
|
3849
|
+
*
|
|
3850
|
+
* # Arguments
|
|
3851
|
+
*
|
|
3852
|
+
* * `update` - Partial preprocessing options update
|
|
3853
|
+
*
|
|
3854
|
+
* # Returns
|
|
3855
|
+
*
|
|
3856
|
+
* New `PreprocessingOptions` with specified updates applied to defaults
|
|
3857
|
+
* @param {WasmPreprocessingOptionsUpdate} update
|
|
3858
|
+
* @returns {WasmPreprocessingOptions}
|
|
3859
|
+
*/
|
|
3860
|
+
static fromUpdate(update) {
|
|
3861
|
+
_assertClass(update, WasmPreprocessingOptionsUpdate);
|
|
3862
|
+
var ptr0 = update.__destroy_into_raw();
|
|
3863
|
+
const ret = wasm.wasmpreprocessingoptions_fromUpdate(ptr0);
|
|
3864
|
+
return WasmPreprocessingOptions.__wrap(ret);
|
|
3865
|
+
}
|
|
3417
3866
|
/**
|
|
3418
3867
|
* @param {boolean | null} [enabled]
|
|
3419
3868
|
* @param {WasmPreprocessingPreset | null} [preset]
|
|
@@ -3474,6 +3923,13 @@ export class WasmPreprocessingOptions {
|
|
|
3474
3923
|
}
|
|
3475
3924
|
if (Symbol.dispose) WasmPreprocessingOptions.prototype[Symbol.dispose] = WasmPreprocessingOptions.prototype.free;
|
|
3476
3925
|
|
|
3926
|
+
/**
|
|
3927
|
+
* Partial update for `PreprocessingOptions`.
|
|
3928
|
+
*
|
|
3929
|
+
* This struct uses `Option<T>` to represent optional fields that can be selectively updated.
|
|
3930
|
+
* Only specified fields (Some values) will override existing options; None values leave the
|
|
3931
|
+
* corresponding fields unchanged when applied via [`PreprocessingOptions::apply_update`].
|
|
3932
|
+
*/
|
|
3477
3933
|
export class WasmPreprocessingOptionsUpdate {
|
|
3478
3934
|
static __wrap(ptr) {
|
|
3479
3935
|
ptr = ptr >>> 0;
|
|
@@ -3560,6 +4016,9 @@ export class WasmPreprocessingOptionsUpdate {
|
|
|
3560
4016
|
if (Symbol.dispose) WasmPreprocessingOptionsUpdate.prototype[Symbol.dispose] = WasmPreprocessingOptionsUpdate.prototype.free;
|
|
3561
4017
|
|
|
3562
4018
|
/**
|
|
4019
|
+
* HTML preprocessing aggressiveness level.
|
|
4020
|
+
*
|
|
4021
|
+
* Controls the extent of cleanup performed before conversion. Higher levels remove more elements.
|
|
3563
4022
|
* @enum {0 | 1 | 2}
|
|
3564
4023
|
*/
|
|
3565
4024
|
export const WasmPreprocessingPreset = Object.freeze({
|
|
@@ -3568,6 +4027,9 @@ export const WasmPreprocessingPreset = Object.freeze({
|
|
|
3568
4027
|
Aggressive: 2, "2": "Aggressive",
|
|
3569
4028
|
});
|
|
3570
4029
|
|
|
4030
|
+
/**
|
|
4031
|
+
* A non-fatal warning generated during HTML processing.
|
|
4032
|
+
*/
|
|
3571
4033
|
export class WasmProcessingWarning {
|
|
3572
4034
|
static __wrap(ptr) {
|
|
3573
4035
|
ptr = ptr >>> 0;
|
|
@@ -3615,7 +4077,7 @@ export class WasmProcessingWarning {
|
|
|
3615
4077
|
return getStringFromWasm0(r0, r1);
|
|
3616
4078
|
} finally {
|
|
3617
4079
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
3618
|
-
wasm.
|
|
4080
|
+
wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
|
|
3619
4081
|
}
|
|
3620
4082
|
}
|
|
3621
4083
|
/**
|
|
@@ -3647,6 +4109,25 @@ export class WasmProcessingWarning {
|
|
|
3647
4109
|
}
|
|
3648
4110
|
if (Symbol.dispose) WasmProcessingWarning.prototype[Symbol.dispose] = WasmProcessingWarning.prototype.free;
|
|
3649
4111
|
|
|
4112
|
+
/**
|
|
4113
|
+
* Structured data block (JSON-LD, Microdata, or RDFa).
|
|
4114
|
+
*
|
|
4115
|
+
* Represents machine-readable structured data found in the document.
|
|
4116
|
+
* JSON-LD blocks are collected as raw JSON strings for flexibility.
|
|
4117
|
+
*
|
|
4118
|
+
* # Examples
|
|
4119
|
+
*
|
|
4120
|
+
* ```
|
|
4121
|
+
* # use html_to_markdown_rs::metadata::{StructuredData, StructuredDataType};
|
|
4122
|
+
* let schema = StructuredData {
|
|
4123
|
+
* data_type: StructuredDataType::JsonLd,
|
|
4124
|
+
* raw_json: r#"{"@context":"https://schema.org","@type":"Article"}"#.to_string(),
|
|
4125
|
+
* schema_type: Some("Article".to_string()),
|
|
4126
|
+
* };
|
|
4127
|
+
*
|
|
4128
|
+
* assert_eq!(schema.data_type, StructuredDataType::JsonLd);
|
|
4129
|
+
* ```
|
|
4130
|
+
*/
|
|
3650
4131
|
export class WasmStructuredData {
|
|
3651
4132
|
static __wrap(ptr) {
|
|
3652
4133
|
ptr = ptr >>> 0;
|
|
@@ -3709,7 +4190,7 @@ export class WasmStructuredData {
|
|
|
3709
4190
|
return getStringFromWasm0(r0, r1);
|
|
3710
4191
|
} finally {
|
|
3711
4192
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
3712
|
-
wasm.
|
|
4193
|
+
wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
|
|
3713
4194
|
}
|
|
3714
4195
|
}
|
|
3715
4196
|
/**
|
|
@@ -3724,7 +4205,7 @@ export class WasmStructuredData {
|
|
|
3724
4205
|
let v1;
|
|
3725
4206
|
if (r0 !== 0) {
|
|
3726
4207
|
v1 = getStringFromWasm0(r0, r1).slice();
|
|
3727
|
-
wasm.
|
|
4208
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
3728
4209
|
}
|
|
3729
4210
|
return v1;
|
|
3730
4211
|
} finally {
|
|
@@ -3757,6 +4238,9 @@ export class WasmStructuredData {
|
|
|
3757
4238
|
if (Symbol.dispose) WasmStructuredData.prototype[Symbol.dispose] = WasmStructuredData.prototype.free;
|
|
3758
4239
|
|
|
3759
4240
|
/**
|
|
4241
|
+
* Structured data format type.
|
|
4242
|
+
*
|
|
4243
|
+
* Identifies the schema/format used for structured data markup.
|
|
3760
4244
|
* @enum {0 | 1 | 2}
|
|
3761
4245
|
*/
|
|
3762
4246
|
export const WasmStructuredDataType = Object.freeze({
|
|
@@ -3765,6 +4249,9 @@ export const WasmStructuredDataType = Object.freeze({
|
|
|
3765
4249
|
RDFa: 2, "2": "RDFa",
|
|
3766
4250
|
});
|
|
3767
4251
|
|
|
4252
|
+
/**
|
|
4253
|
+
* A top-level extracted table with both structured data and markdown representation.
|
|
4254
|
+
*/
|
|
3768
4255
|
export class WasmTableData {
|
|
3769
4256
|
static __wrap(ptr) {
|
|
3770
4257
|
ptr = ptr >>> 0;
|
|
@@ -3812,7 +4299,7 @@ export class WasmTableData {
|
|
|
3812
4299
|
return getStringFromWasm0(r0, r1);
|
|
3813
4300
|
} finally {
|
|
3814
4301
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
3815
|
-
wasm.
|
|
4302
|
+
wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
|
|
3816
4303
|
}
|
|
3817
4304
|
}
|
|
3818
4305
|
/**
|
|
@@ -3848,6 +4335,9 @@ export class WasmTableData {
|
|
|
3848
4335
|
}
|
|
3849
4336
|
if (Symbol.dispose) WasmTableData.prototype[Symbol.dispose] = WasmTableData.prototype.free;
|
|
3850
4337
|
|
|
4338
|
+
/**
|
|
4339
|
+
* A structured table grid with cell-level data including spans.
|
|
4340
|
+
*/
|
|
3851
4341
|
export class WasmTableGrid {
|
|
3852
4342
|
static __wrap(ptr) {
|
|
3853
4343
|
ptr = ptr >>> 0;
|
|
@@ -3876,7 +4366,7 @@ export class WasmTableGrid {
|
|
|
3876
4366
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
3877
4367
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
3878
4368
|
var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
|
|
3879
|
-
wasm.
|
|
4369
|
+
wasm.__wbindgen_export4(r0, r1 * 4, 4);
|
|
3880
4370
|
return v1;
|
|
3881
4371
|
} finally {
|
|
3882
4372
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
@@ -3932,6 +4422,11 @@ export class WasmTableGrid {
|
|
|
3932
4422
|
}
|
|
3933
4423
|
if (Symbol.dispose) WasmTableGrid.prototype[Symbol.dispose] = WasmTableGrid.prototype.free;
|
|
3934
4424
|
|
|
4425
|
+
/**
|
|
4426
|
+
* An inline text annotation with byte-range offsets.
|
|
4427
|
+
*
|
|
4428
|
+
* Annotations describe formatting (bold, italic, etc.) and links within a node's text content.
|
|
4429
|
+
*/
|
|
3935
4430
|
export class WasmTextAnnotation {
|
|
3936
4431
|
static __wrap(ptr) {
|
|
3937
4432
|
ptr = ptr >>> 0;
|
|
@@ -4010,6 +4505,9 @@ export class WasmTextAnnotation {
|
|
|
4010
4505
|
if (Symbol.dispose) WasmTextAnnotation.prototype[Symbol.dispose] = WasmTextAnnotation.prototype.free;
|
|
4011
4506
|
|
|
4012
4507
|
/**
|
|
4508
|
+
* Text directionality of document content.
|
|
4509
|
+
*
|
|
4510
|
+
* Corresponds to the HTML `dir` attribute and `bdi` element directionality.
|
|
4013
4511
|
* @enum {0 | 1 | 2}
|
|
4014
4512
|
*/
|
|
4015
4513
|
export const WasmTextDirection = Object.freeze({
|
|
@@ -4019,17 +4517,38 @@ export const WasmTextDirection = Object.freeze({
|
|
|
4019
4517
|
});
|
|
4020
4518
|
|
|
4021
4519
|
/**
|
|
4520
|
+
* Result of a visitor callback.
|
|
4521
|
+
*
|
|
4522
|
+
* Allows visitors to control the conversion flow by either proceeding
|
|
4523
|
+
* with default behavior, providing custom output, skipping elements,
|
|
4524
|
+
* preserving HTML, or signaling errors.
|
|
4022
4525
|
* @enum {0 | 1 | 2 | 3 | 4}
|
|
4023
4526
|
*/
|
|
4527
|
+
export const WasmVisitResult = Object.freeze({
|
|
4528
|
+
Continue: 0, "0": "Continue",
|
|
4529
|
+
Custom: 1, "1": "Custom",
|
|
4530
|
+
Skip: 2, "2": "Skip",
|
|
4531
|
+
PreserveHtml: 3, "3": "PreserveHtml",
|
|
4532
|
+
Error: 4, "4": "Error",
|
|
4533
|
+
});
|
|
4534
|
+
|
|
4535
|
+
/**
|
|
4536
|
+
* Categories of processing warnings.
|
|
4537
|
+
* @enum {0 | 1 | 2 | 3 | 4 | 5}
|
|
4538
|
+
*/
|
|
4024
4539
|
export const WasmWarningKind = Object.freeze({
|
|
4025
4540
|
ImageExtractionFailed: 0, "0": "ImageExtractionFailed",
|
|
4026
4541
|
EncodingFallback: 1, "1": "EncodingFallback",
|
|
4027
4542
|
TruncatedInput: 2, "2": "TruncatedInput",
|
|
4028
4543
|
MalformedHtml: 3, "3": "MalformedHtml",
|
|
4029
4544
|
SanitizationApplied: 4, "4": "SanitizationApplied",
|
|
4545
|
+
DepthLimitExceeded: 5, "5": "DepthLimitExceeded",
|
|
4030
4546
|
});
|
|
4031
4547
|
|
|
4032
4548
|
/**
|
|
4549
|
+
* Whitespace handling strategy during conversion.
|
|
4550
|
+
*
|
|
4551
|
+
* Determines how sequences of whitespace characters (spaces, tabs, newlines) are processed.
|
|
4033
4552
|
* @enum {0 | 1}
|
|
4034
4553
|
*/
|
|
4035
4554
|
export const WasmWhitespaceMode = Object.freeze({
|
|
@@ -4040,9 +4559,10 @@ export const WasmWhitespaceMode = Object.freeze({
|
|
|
4040
4559
|
/**
|
|
4041
4560
|
* @param {string} html
|
|
4042
4561
|
* @param {WasmConversionOptions | null} [options]
|
|
4562
|
+
* @param {any | null} [visitor]
|
|
4043
4563
|
* @returns {WasmConversionResult}
|
|
4044
4564
|
*/
|
|
4045
|
-
export function convert(html, options) {
|
|
4565
|
+
export function convert(html, options, visitor) {
|
|
4046
4566
|
try {
|
|
4047
4567
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
4048
4568
|
const ptr0 = passStringToWasm0(html, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
@@ -4052,7 +4572,7 @@ export function convert(html, options) {
|
|
|
4052
4572
|
_assertClass(options, WasmConversionOptions);
|
|
4053
4573
|
ptr1 = options.__destroy_into_raw();
|
|
4054
4574
|
}
|
|
4055
|
-
wasm.convert(retptr, ptr0, len0, ptr1);
|
|
4575
|
+
wasm.convert(retptr, ptr0, len0, ptr1, isLikeNone(visitor) ? 0 : addHeapObject(visitor));
|
|
4056
4576
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
4057
4577
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
4058
4578
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -4068,6 +4588,10 @@ export function __wbg_Error_960c155d3d49e4c2(arg0, arg1) {
|
|
|
4068
4588
|
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
4069
4589
|
return addHeapObject(ret);
|
|
4070
4590
|
}
|
|
4591
|
+
export function __wbg___wbindgen_is_function_3baa9db1a987f47d(arg0) {
|
|
4592
|
+
const ret = typeof(getObject(arg0)) === 'function';
|
|
4593
|
+
return ret;
|
|
4594
|
+
}
|
|
4071
4595
|
export function __wbg___wbindgen_is_string_6df3bf7ef1164ed3(arg0) {
|
|
4072
4596
|
const ret = typeof(getObject(arg0)) === 'string';
|
|
4073
4597
|
return ret;
|
|
@@ -4087,14 +4611,38 @@ export function __wbg___wbindgen_string_get_7ed5322991caaec5(arg0, arg1) {
|
|
|
4087
4611
|
export function __wbg___wbindgen_throw_6b64449b9b9ed33c(arg0, arg1) {
|
|
4088
4612
|
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
4089
4613
|
}
|
|
4614
|
+
export function __wbg_apply_4c35bd236dda9c14() { return handleError(function (arg0, arg1, arg2) {
|
|
4615
|
+
const ret = getObject(arg0).apply(getObject(arg1), getObject(arg2));
|
|
4616
|
+
return addHeapObject(ret);
|
|
4617
|
+
}, arguments); }
|
|
4618
|
+
export function __wbg_get_6011fa3a58f61074() { return handleError(function (arg0, arg1) {
|
|
4619
|
+
const ret = Reflect.get(getObject(arg0), getObject(arg1));
|
|
4620
|
+
return addHeapObject(ret);
|
|
4621
|
+
}, arguments); }
|
|
4622
|
+
export function __wbg_has_880f1d472f7cecba() { return handleError(function (arg0, arg1) {
|
|
4623
|
+
const ret = Reflect.has(getObject(arg0), getObject(arg1));
|
|
4624
|
+
return ret;
|
|
4625
|
+
}, arguments); }
|
|
4090
4626
|
export function __wbg_new_34d45cc8e36aaead() {
|
|
4091
4627
|
const ret = new Map();
|
|
4092
4628
|
return addHeapObject(ret);
|
|
4093
4629
|
}
|
|
4630
|
+
export function __wbg_new_682678e2f47e32bc() {
|
|
4631
|
+
const ret = new Array();
|
|
4632
|
+
return addHeapObject(ret);
|
|
4633
|
+
}
|
|
4094
4634
|
export function __wbg_new_aa8d0fa9762c29bd() {
|
|
4095
4635
|
const ret = new Object();
|
|
4096
4636
|
return addHeapObject(ret);
|
|
4097
4637
|
}
|
|
4638
|
+
export function __wbg_push_471a5b068a5295f6(arg0, arg1) {
|
|
4639
|
+
const ret = getObject(arg0).push(getObject(arg1));
|
|
4640
|
+
return ret;
|
|
4641
|
+
}
|
|
4642
|
+
export function __wbg_set_022bee52d0b05b19() { return handleError(function (arg0, arg1, arg2) {
|
|
4643
|
+
const ret = Reflect.set(getObject(arg0), getObject(arg1), getObject(arg2));
|
|
4644
|
+
return ret;
|
|
4645
|
+
}, arguments); }
|
|
4098
4646
|
export function __wbg_set_6be42768c690e380(arg0, arg1, arg2) {
|
|
4099
4647
|
getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
|
|
4100
4648
|
}
|
|
@@ -4174,7 +4722,12 @@ export function __wbg_wasmtextannotation_unwrap(arg0) {
|
|
|
4174
4722
|
const ret = WasmTextAnnotation.__unwrap(getObject(arg0));
|
|
4175
4723
|
return ret;
|
|
4176
4724
|
}
|
|
4177
|
-
export function __wbindgen_cast_0000000000000001(arg0
|
|
4725
|
+
export function __wbindgen_cast_0000000000000001(arg0) {
|
|
4726
|
+
// Cast intrinsic for `F64 -> Externref`.
|
|
4727
|
+
const ret = arg0;
|
|
4728
|
+
return addHeapObject(ret);
|
|
4729
|
+
}
|
|
4730
|
+
export function __wbindgen_cast_0000000000000002(arg0, arg1) {
|
|
4178
4731
|
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
4179
4732
|
const ret = getStringFromWasm0(arg0, arg1);
|
|
4180
4733
|
return addHeapObject(ret);
|
|
@@ -4222,12 +4775,9 @@ const WasmImageMetadataFinalization = (typeof FinalizationRegistry === 'undefine
|
|
|
4222
4775
|
const WasmLinkMetadataFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
4223
4776
|
? { register: () => {}, unregister: () => {} }
|
|
4224
4777
|
: new FinalizationRegistry(ptr => wasm.__wbg_wasmlinkmetadata_free(ptr >>> 0, 1));
|
|
4225
|
-
const
|
|
4778
|
+
const WasmNodeContextFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
4226
4779
|
? { register: () => {}, unregister: () => {} }
|
|
4227
|
-
: new FinalizationRegistry(ptr => wasm.
|
|
4228
|
-
const WasmMetadataConfigUpdateFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
4229
|
-
? { register: () => {}, unregister: () => {} }
|
|
4230
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_wasmmetadataconfigupdate_free(ptr >>> 0, 1));
|
|
4780
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_wasmnodecontext_free(ptr >>> 0, 1));
|
|
4231
4781
|
const WasmPreprocessingOptionsFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
4232
4782
|
? { register: () => {}, unregister: () => {} }
|
|
4233
4783
|
: new FinalizationRegistry(ptr => wasm.__wbg_wasmpreprocessingoptions_free(ptr >>> 0, 1));
|
|
@@ -4317,6 +4867,14 @@ function getUint8ArrayMemory0() {
|
|
|
4317
4867
|
|
|
4318
4868
|
function getObject(idx) { return heap[idx]; }
|
|
4319
4869
|
|
|
4870
|
+
function handleError(f, args) {
|
|
4871
|
+
try {
|
|
4872
|
+
return f.apply(this, args);
|
|
4873
|
+
} catch (e) {
|
|
4874
|
+
wasm.__wbindgen_export3(addHeapObject(e));
|
|
4875
|
+
}
|
|
4876
|
+
}
|
|
4877
|
+
|
|
4320
4878
|
let heap = new Array(1024).fill(undefined);
|
|
4321
4879
|
heap.push(undefined, null, true, false);
|
|
4322
4880
|
|