@kreuzberg/html-to-markdown-wasm 3.2.4 → 3.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/html_to_markdown_wasm.d.ts +539 -38
- package/dist/html_to_markdown_wasm_bg.js +826 -268
- package/dist/html_to_markdown_wasm_bg.wasm +0 -0
- package/dist/html_to_markdown_wasm_bg.wasm.d.ts +39 -37
- package/dist/package.json +6 -1
- package/dist-node/html_to_markdown_wasm.d.ts +539 -38
- package/dist-node/html_to_markdown_wasm.js +831 -272
- package/dist-node/html_to_markdown_wasm_bg.wasm +0 -0
- package/dist-node/html_to_markdown_wasm_bg.wasm.d.ts +39 -37
- package/dist-node/package.json +7 -2
- package/dist-web/html_to_markdown_wasm.d.ts +578 -75
- package/dist-web/html_to_markdown_wasm.js +826 -268
- package/dist-web/html_to_markdown_wasm_bg.wasm +0 -0
- package/dist-web/html_to_markdown_wasm_bg.wasm.d.ts +39 -37
- package/dist-web/package.json +6 -1
- package/package.json +2 -2
|
@@ -5,6 +5,9 @@
|
|
|
5
5
|
/* @ts-self-types="./html_to_markdown_wasm.d.ts" */
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
+
* The type of an inline text annotation.
|
|
9
|
+
*
|
|
10
|
+
* Uses internally tagged representation (`"annotation_type": "bold"`) for JSON serialization.
|
|
8
11
|
* @enum {0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8}
|
|
9
12
|
*/
|
|
10
13
|
export const WasmAnnotationKind = Object.freeze({
|
|
@@ -20,6 +23,9 @@ export const WasmAnnotationKind = Object.freeze({
|
|
|
20
23
|
});
|
|
21
24
|
|
|
22
25
|
/**
|
|
26
|
+
* Code block fence style in Markdown output.
|
|
27
|
+
*
|
|
28
|
+
* Determines how code blocks (`<pre><code>`) are rendered in Markdown.
|
|
23
29
|
* @enum {0 | 1 | 2}
|
|
24
30
|
*/
|
|
25
31
|
export const WasmCodeBlockStyle = Object.freeze({
|
|
@@ -28,6 +34,23 @@ export const WasmCodeBlockStyle = Object.freeze({
|
|
|
28
34
|
Tildes: 2, "2": "Tildes",
|
|
29
35
|
});
|
|
30
36
|
|
|
37
|
+
/**
|
|
38
|
+
* Main conversion options for HTML to Markdown conversion.
|
|
39
|
+
*
|
|
40
|
+
* Use [`ConversionOptions::builder()`] to construct, or [`Default::default()`] for defaults.
|
|
41
|
+
*
|
|
42
|
+
* # Example
|
|
43
|
+
*
|
|
44
|
+
* ```text
|
|
45
|
+
* use html_to_markdown_rs::ConversionOptions;
|
|
46
|
+
*
|
|
47
|
+
* let options = ConversionOptions::builder()
|
|
48
|
+
* .heading_style(HeadingStyle::Atx)
|
|
49
|
+
* .wrap(true)
|
|
50
|
+
* .wrap_width(100)
|
|
51
|
+
* .build();
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
31
54
|
export class WasmConversionOptions {
|
|
32
55
|
static __wrap(ptr) {
|
|
33
56
|
ptr = ptr >>> 0;
|
|
@@ -46,6 +69,15 @@ export class WasmConversionOptions {
|
|
|
46
69
|
const ptr = this.__destroy_into_raw();
|
|
47
70
|
wasm.__wbg_wasmconversionoptions_free(ptr, 0);
|
|
48
71
|
}
|
|
72
|
+
/**
|
|
73
|
+
* Apply a partial update to these conversion options.
|
|
74
|
+
* @param {WasmConversionOptionsUpdate} _update
|
|
75
|
+
*/
|
|
76
|
+
applyUpdate(_update) {
|
|
77
|
+
_assertClass(_update, WasmConversionOptionsUpdate);
|
|
78
|
+
var ptr0 = _update.__destroy_into_raw();
|
|
79
|
+
wasm.wasmconversionoptions_applyUpdate(this.__wbg_ptr, ptr0);
|
|
80
|
+
}
|
|
49
81
|
/**
|
|
50
82
|
* @returns {boolean}
|
|
51
83
|
*/
|
|
@@ -61,6 +93,7 @@ export class WasmConversionOptions {
|
|
|
61
93
|
return ret !== 0;
|
|
62
94
|
}
|
|
63
95
|
/**
|
|
96
|
+
* Create a new builder with default values.
|
|
64
97
|
* @returns {WasmConversionOptionsBuilder}
|
|
65
98
|
*/
|
|
66
99
|
static builder() {
|
|
@@ -83,7 +116,7 @@ export class WasmConversionOptions {
|
|
|
83
116
|
return getStringFromWasm0(r0, r1);
|
|
84
117
|
} finally {
|
|
85
118
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
86
|
-
wasm.
|
|
119
|
+
wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
|
|
87
120
|
}
|
|
88
121
|
}
|
|
89
122
|
/**
|
|
@@ -116,7 +149,7 @@ export class WasmConversionOptions {
|
|
|
116
149
|
return getStringFromWasm0(r0, r1);
|
|
117
150
|
} finally {
|
|
118
151
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
119
|
-
wasm.
|
|
152
|
+
wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
|
|
120
153
|
}
|
|
121
154
|
}
|
|
122
155
|
/**
|
|
@@ -163,7 +196,7 @@ export class WasmConversionOptions {
|
|
|
163
196
|
return getStringFromWasm0(r0, r1);
|
|
164
197
|
} finally {
|
|
165
198
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
166
|
-
wasm.
|
|
199
|
+
wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
|
|
167
200
|
}
|
|
168
201
|
}
|
|
169
202
|
/**
|
|
@@ -194,6 +227,22 @@ export class WasmConversionOptions {
|
|
|
194
227
|
const ret = wasm.wasmconversionoptions_escapeUnderscores(this.__wbg_ptr);
|
|
195
228
|
return ret !== 0;
|
|
196
229
|
}
|
|
230
|
+
/**
|
|
231
|
+
* @returns {string[]}
|
|
232
|
+
*/
|
|
233
|
+
get excludeSelectors() {
|
|
234
|
+
try {
|
|
235
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
236
|
+
wasm.wasmconversionoptions_excludeSelectors(retptr, this.__wbg_ptr);
|
|
237
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
238
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
239
|
+
var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
|
|
240
|
+
wasm.__wbindgen_export4(r0, r1 * 4, 4);
|
|
241
|
+
return v1;
|
|
242
|
+
} finally {
|
|
243
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
244
|
+
}
|
|
245
|
+
}
|
|
197
246
|
/**
|
|
198
247
|
* @returns {boolean}
|
|
199
248
|
*/
|
|
@@ -208,6 +257,27 @@ export class WasmConversionOptions {
|
|
|
208
257
|
const ret = wasm.wasmconversionoptions_extractMetadata(this.__wbg_ptr);
|
|
209
258
|
return ret !== 0;
|
|
210
259
|
}
|
|
260
|
+
/**
|
|
261
|
+
* @param {WasmConversionOptionsUpdate} update
|
|
262
|
+
* @returns {WasmConversionOptions}
|
|
263
|
+
*/
|
|
264
|
+
static from(update) {
|
|
265
|
+
_assertClass(update, WasmConversionOptionsUpdate);
|
|
266
|
+
var ptr0 = update.__destroy_into_raw();
|
|
267
|
+
const ret = wasm.wasmconversionoptions_from(ptr0);
|
|
268
|
+
return WasmConversionOptions.__wrap(ret);
|
|
269
|
+
}
|
|
270
|
+
/**
|
|
271
|
+
* Create from a partial update, applying to defaults.
|
|
272
|
+
* @param {WasmConversionOptionsUpdate} update
|
|
273
|
+
* @returns {WasmConversionOptions}
|
|
274
|
+
*/
|
|
275
|
+
static fromUpdate(update) {
|
|
276
|
+
_assertClass(update, WasmConversionOptionsUpdate);
|
|
277
|
+
var ptr0 = update.__destroy_into_raw();
|
|
278
|
+
const ret = wasm.wasmconversionoptions_fromUpdate(ptr0);
|
|
279
|
+
return WasmConversionOptions.__wrap(ret);
|
|
280
|
+
}
|
|
211
281
|
/**
|
|
212
282
|
* @returns {WasmHeadingStyle}
|
|
213
283
|
*/
|
|
@@ -246,7 +316,7 @@ export class WasmConversionOptions {
|
|
|
246
316
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
247
317
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
248
318
|
var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
|
|
249
|
-
wasm.
|
|
319
|
+
wasm.__wbindgen_export4(r0, r1 * 4, 4);
|
|
250
320
|
return v1;
|
|
251
321
|
} finally {
|
|
252
322
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
@@ -273,6 +343,13 @@ export class WasmConversionOptions {
|
|
|
273
343
|
const ret = wasm.wasmconversionoptions_listIndentWidth(this.__wbg_ptr);
|
|
274
344
|
return ret >>> 0;
|
|
275
345
|
}
|
|
346
|
+
/**
|
|
347
|
+
* @returns {number | undefined}
|
|
348
|
+
*/
|
|
349
|
+
get maxDepth() {
|
|
350
|
+
const ret = wasm.wasmconversionoptions_maxDepth(this.__wbg_ptr);
|
|
351
|
+
return ret === 0x100000001 ? undefined : ret;
|
|
352
|
+
}
|
|
276
353
|
/**
|
|
277
354
|
* @returns {bigint}
|
|
278
355
|
*/
|
|
@@ -319,8 +396,10 @@ export class WasmConversionOptions {
|
|
|
319
396
|
* @param {bigint | null} [max_image_size]
|
|
320
397
|
* @param {boolean | null} [capture_svg]
|
|
321
398
|
* @param {boolean | null} [infer_dimensions]
|
|
399
|
+
* @param {string[] | null} [exclude_selectors]
|
|
400
|
+
* @param {number | null} [max_depth]
|
|
322
401
|
*/
|
|
323
|
-
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) {
|
|
402
|
+
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) {
|
|
324
403
|
var ptr0 = isLikeNone(bullets) ? 0 : passStringToWasm0(bullets, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
325
404
|
var len0 = WASM_VECTOR_LEN;
|
|
326
405
|
var ptr1 = isLikeNone(strong_em_symbol) ? 0 : passStringToWasm0(strong_em_symbol, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
@@ -344,7 +423,9 @@ export class WasmConversionOptions {
|
|
|
344
423
|
var len8 = WASM_VECTOR_LEN;
|
|
345
424
|
var ptr9 = isLikeNone(preserve_tags) ? 0 : passArrayJsValueToWasm0(preserve_tags, wasm.__wbindgen_export);
|
|
346
425
|
var len9 = WASM_VECTOR_LEN;
|
|
347
|
-
|
|
426
|
+
var ptr10 = isLikeNone(exclude_selectors) ? 0 : passArrayJsValueToWasm0(exclude_selectors, wasm.__wbindgen_export);
|
|
427
|
+
var len10 = WASM_VECTOR_LEN;
|
|
428
|
+
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);
|
|
348
429
|
this.__wbg_ptr = ret >>> 0;
|
|
349
430
|
WasmConversionOptionsFinalization.register(this, this.__wbg_ptr, this);
|
|
350
431
|
return this;
|
|
@@ -380,7 +461,7 @@ export class WasmConversionOptions {
|
|
|
380
461
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
381
462
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
382
463
|
var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
|
|
383
|
-
wasm.
|
|
464
|
+
wasm.__wbindgen_export4(r0, r1 * 4, 4);
|
|
384
465
|
return v1;
|
|
385
466
|
} finally {
|
|
386
467
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
@@ -476,6 +557,14 @@ export class WasmConversionOptions {
|
|
|
476
557
|
set escapeUnderscores(value) {
|
|
477
558
|
wasm.wasmconversionoptions_set_escapeUnderscores(this.__wbg_ptr, value);
|
|
478
559
|
}
|
|
560
|
+
/**
|
|
561
|
+
* @param {string[]} value
|
|
562
|
+
*/
|
|
563
|
+
set excludeSelectors(value) {
|
|
564
|
+
const ptr0 = passArrayJsValueToWasm0(value, wasm.__wbindgen_export);
|
|
565
|
+
const len0 = WASM_VECTOR_LEN;
|
|
566
|
+
wasm.wasmconversionoptions_set_excludeSelectors(this.__wbg_ptr, ptr0, len0);
|
|
567
|
+
}
|
|
479
568
|
/**
|
|
480
569
|
* @param {boolean} value
|
|
481
570
|
*/
|
|
@@ -538,6 +627,12 @@ export class WasmConversionOptions {
|
|
|
538
627
|
set listIndentWidth(value) {
|
|
539
628
|
wasm.wasmconversionoptions_set_listIndentWidth(this.__wbg_ptr, value);
|
|
540
629
|
}
|
|
630
|
+
/**
|
|
631
|
+
* @param {number | null} [value]
|
|
632
|
+
*/
|
|
633
|
+
set maxDepth(value) {
|
|
634
|
+
wasm.wasmconversionoptions_set_maxDepth(this.__wbg_ptr, isLikeNone(value) ? 0x100000001 : (value) >>> 0);
|
|
635
|
+
}
|
|
541
636
|
/**
|
|
542
637
|
* @param {bigint} value
|
|
543
638
|
*/
|
|
@@ -658,7 +753,7 @@ export class WasmConversionOptions {
|
|
|
658
753
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
659
754
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
660
755
|
var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
|
|
661
|
-
wasm.
|
|
756
|
+
wasm.__wbindgen_export4(r0, r1 * 4, 4);
|
|
662
757
|
return v1;
|
|
663
758
|
} finally {
|
|
664
759
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
@@ -680,7 +775,7 @@ export class WasmConversionOptions {
|
|
|
680
775
|
return getStringFromWasm0(r0, r1);
|
|
681
776
|
} finally {
|
|
682
777
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
683
|
-
wasm.
|
|
778
|
+
wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
|
|
684
779
|
}
|
|
685
780
|
}
|
|
686
781
|
/**
|
|
@@ -699,7 +794,7 @@ export class WasmConversionOptions {
|
|
|
699
794
|
return getStringFromWasm0(r0, r1);
|
|
700
795
|
} finally {
|
|
701
796
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
702
|
-
wasm.
|
|
797
|
+
wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
|
|
703
798
|
}
|
|
704
799
|
}
|
|
705
800
|
/**
|
|
@@ -718,7 +813,7 @@ export class WasmConversionOptions {
|
|
|
718
813
|
return getStringFromWasm0(r0, r1);
|
|
719
814
|
} finally {
|
|
720
815
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
721
|
-
wasm.
|
|
816
|
+
wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
|
|
722
817
|
}
|
|
723
818
|
}
|
|
724
819
|
/**
|
|
@@ -745,6 +840,11 @@ export class WasmConversionOptions {
|
|
|
745
840
|
}
|
|
746
841
|
if (Symbol.dispose) WasmConversionOptions.prototype[Symbol.dispose] = WasmConversionOptions.prototype.free;
|
|
747
842
|
|
|
843
|
+
/**
|
|
844
|
+
* Builder for [`ConversionOptions`].
|
|
845
|
+
*
|
|
846
|
+
* All fields start with default values. Call `.build()` to produce the final options.
|
|
847
|
+
*/
|
|
748
848
|
export class WasmConversionOptionsBuilder {
|
|
749
849
|
static __wrap(ptr) {
|
|
750
850
|
ptr = ptr >>> 0;
|
|
@@ -764,6 +864,7 @@ export class WasmConversionOptionsBuilder {
|
|
|
764
864
|
wasm.__wbg_wasmconversionoptionsbuilder_free(ptr, 0);
|
|
765
865
|
}
|
|
766
866
|
/**
|
|
867
|
+
* Build the final [`ConversionOptions`].
|
|
767
868
|
* @returns {WasmConversionOptions}
|
|
768
869
|
*/
|
|
769
870
|
build() {
|
|
@@ -771,6 +872,18 @@ export class WasmConversionOptionsBuilder {
|
|
|
771
872
|
return WasmConversionOptions.__wrap(ret);
|
|
772
873
|
}
|
|
773
874
|
/**
|
|
875
|
+
* Set the list of CSS selectors for elements to exclude entirely from output.
|
|
876
|
+
* @param {string[]} selectors
|
|
877
|
+
* @returns {WasmConversionOptionsBuilder}
|
|
878
|
+
*/
|
|
879
|
+
excludeSelectors(selectors) {
|
|
880
|
+
const ptr0 = passArrayJsValueToWasm0(selectors, wasm.__wbindgen_export);
|
|
881
|
+
const len0 = WASM_VECTOR_LEN;
|
|
882
|
+
const ret = wasm.wasmconversionoptionsbuilder_excludeSelectors(this.__wbg_ptr, ptr0, len0);
|
|
883
|
+
return WasmConversionOptionsBuilder.__wrap(ret);
|
|
884
|
+
}
|
|
885
|
+
/**
|
|
886
|
+
* Set the list of HTML tag names whose `<img>` children are kept inline.
|
|
774
887
|
* @param {string[]} tags
|
|
775
888
|
* @returns {WasmConversionOptionsBuilder}
|
|
776
889
|
*/
|
|
@@ -781,6 +894,7 @@ export class WasmConversionOptionsBuilder {
|
|
|
781
894
|
return WasmConversionOptionsBuilder.__wrap(ret);
|
|
782
895
|
}
|
|
783
896
|
/**
|
|
897
|
+
* Set the pre-processing options applied to the HTML before conversion.
|
|
784
898
|
* @param {WasmPreprocessingOptions} preprocessing
|
|
785
899
|
* @returns {WasmConversionOptionsBuilder}
|
|
786
900
|
*/
|
|
@@ -791,6 +905,7 @@ export class WasmConversionOptionsBuilder {
|
|
|
791
905
|
return WasmConversionOptionsBuilder.__wrap(ret);
|
|
792
906
|
}
|
|
793
907
|
/**
|
|
908
|
+
* Set the list of HTML tag names that are preserved verbatim in output.
|
|
794
909
|
* @param {string[]} tags
|
|
795
910
|
* @returns {WasmConversionOptionsBuilder}
|
|
796
911
|
*/
|
|
@@ -801,6 +916,7 @@ export class WasmConversionOptionsBuilder {
|
|
|
801
916
|
return WasmConversionOptionsBuilder.__wrap(ret);
|
|
802
917
|
}
|
|
803
918
|
/**
|
|
919
|
+
* Set the list of HTML tag names whose content is stripped from output.
|
|
804
920
|
* @param {string[]} tags
|
|
805
921
|
* @returns {WasmConversionOptionsBuilder}
|
|
806
922
|
*/
|
|
@@ -813,6 +929,12 @@ export class WasmConversionOptionsBuilder {
|
|
|
813
929
|
}
|
|
814
930
|
if (Symbol.dispose) WasmConversionOptionsBuilder.prototype[Symbol.dispose] = WasmConversionOptionsBuilder.prototype.free;
|
|
815
931
|
|
|
932
|
+
/**
|
|
933
|
+
* Partial update for `ConversionOptions`.
|
|
934
|
+
*
|
|
935
|
+
* Uses `Option<T>` fields for selective updates. Bindings use this to construct
|
|
936
|
+
* options from language-native types. Prefer [`ConversionOptionsBuilder`] for Rust code.
|
|
937
|
+
*/
|
|
816
938
|
export class WasmConversionOptionsUpdate {
|
|
817
939
|
__destroy_into_raw() {
|
|
818
940
|
const ptr = this.__wbg_ptr;
|
|
@@ -850,7 +972,7 @@ export class WasmConversionOptionsUpdate {
|
|
|
850
972
|
let v1;
|
|
851
973
|
if (r0 !== 0) {
|
|
852
974
|
v1 = getStringFromWasm0(r0, r1).slice();
|
|
853
|
-
wasm.
|
|
975
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
854
976
|
}
|
|
855
977
|
return v1;
|
|
856
978
|
} finally {
|
|
@@ -883,7 +1005,7 @@ export class WasmConversionOptionsUpdate {
|
|
|
883
1005
|
let v1;
|
|
884
1006
|
if (r0 !== 0) {
|
|
885
1007
|
v1 = getStringFromWasm0(r0, r1).slice();
|
|
886
|
-
wasm.
|
|
1008
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
887
1009
|
}
|
|
888
1010
|
return v1;
|
|
889
1011
|
} finally {
|
|
@@ -923,7 +1045,7 @@ export class WasmConversionOptionsUpdate {
|
|
|
923
1045
|
let v1;
|
|
924
1046
|
if (r0 !== 0) {
|
|
925
1047
|
v1 = getStringFromWasm0(r0, r1).slice();
|
|
926
|
-
wasm.
|
|
1048
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
927
1049
|
}
|
|
928
1050
|
return v1;
|
|
929
1051
|
} finally {
|
|
@@ -958,6 +1080,25 @@ export class WasmConversionOptionsUpdate {
|
|
|
958
1080
|
const ret = wasm.wasmconversionoptionsupdate_escapeUnderscores(this.__wbg_ptr);
|
|
959
1081
|
return ret === 0xFFFFFF ? undefined : ret !== 0;
|
|
960
1082
|
}
|
|
1083
|
+
/**
|
|
1084
|
+
* @returns {string[] | undefined}
|
|
1085
|
+
*/
|
|
1086
|
+
get excludeSelectors() {
|
|
1087
|
+
try {
|
|
1088
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1089
|
+
wasm.wasmconversionoptionsupdate_excludeSelectors(retptr, this.__wbg_ptr);
|
|
1090
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1091
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1092
|
+
let v1;
|
|
1093
|
+
if (r0 !== 0) {
|
|
1094
|
+
v1 = getArrayJsValueFromWasm0(r0, r1).slice();
|
|
1095
|
+
wasm.__wbindgen_export4(r0, r1 * 4, 4);
|
|
1096
|
+
}
|
|
1097
|
+
return v1;
|
|
1098
|
+
} finally {
|
|
1099
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1100
|
+
}
|
|
1101
|
+
}
|
|
961
1102
|
/**
|
|
962
1103
|
* @returns {boolean | undefined}
|
|
963
1104
|
*/
|
|
@@ -1012,7 +1153,7 @@ export class WasmConversionOptionsUpdate {
|
|
|
1012
1153
|
let v1;
|
|
1013
1154
|
if (r0 !== 0) {
|
|
1014
1155
|
v1 = getArrayJsValueFromWasm0(r0, r1).slice();
|
|
1015
|
-
wasm.
|
|
1156
|
+
wasm.__wbindgen_export4(r0, r1 * 4, 4);
|
|
1016
1157
|
}
|
|
1017
1158
|
return v1;
|
|
1018
1159
|
} finally {
|
|
@@ -1040,6 +1181,13 @@ export class WasmConversionOptionsUpdate {
|
|
|
1040
1181
|
const ret = wasm.wasmconversionoptionsupdate_listIndentWidth(this.__wbg_ptr);
|
|
1041
1182
|
return ret === 0x100000001 ? undefined : ret;
|
|
1042
1183
|
}
|
|
1184
|
+
/**
|
|
1185
|
+
* @returns {number | undefined}
|
|
1186
|
+
*/
|
|
1187
|
+
get maxDepth() {
|
|
1188
|
+
const ret = wasm.wasmconversionoptionsupdate_maxDepth(this.__wbg_ptr);
|
|
1189
|
+
return ret === 0x100000001 ? undefined : ret;
|
|
1190
|
+
}
|
|
1043
1191
|
/**
|
|
1044
1192
|
* @returns {bigint | undefined}
|
|
1045
1193
|
*/
|
|
@@ -1093,8 +1241,10 @@ export class WasmConversionOptionsUpdate {
|
|
|
1093
1241
|
* @param {bigint | null} [max_image_size]
|
|
1094
1242
|
* @param {boolean | null} [capture_svg]
|
|
1095
1243
|
* @param {boolean | null} [infer_dimensions]
|
|
1244
|
+
* @param {number | null} [max_depth]
|
|
1245
|
+
* @param {string[] | null} [exclude_selectors]
|
|
1096
1246
|
*/
|
|
1097
|
-
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) {
|
|
1247
|
+
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) {
|
|
1098
1248
|
var ptr0 = isLikeNone(bullets) ? 0 : passStringToWasm0(bullets, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1099
1249
|
var len0 = WASM_VECTOR_LEN;
|
|
1100
1250
|
var ptr1 = isLikeNone(strong_em_symbol) ? 0 : passStringToWasm0(strong_em_symbol, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
@@ -1118,7 +1268,9 @@ export class WasmConversionOptionsUpdate {
|
|
|
1118
1268
|
var len8 = WASM_VECTOR_LEN;
|
|
1119
1269
|
var ptr9 = isLikeNone(preserve_tags) ? 0 : passArrayJsValueToWasm0(preserve_tags, wasm.__wbindgen_export);
|
|
1120
1270
|
var len9 = WASM_VECTOR_LEN;
|
|
1121
|
-
|
|
1271
|
+
var ptr10 = isLikeNone(exclude_selectors) ? 0 : passArrayJsValueToWasm0(exclude_selectors, wasm.__wbindgen_export);
|
|
1272
|
+
var len10 = WASM_VECTOR_LEN;
|
|
1273
|
+
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);
|
|
1122
1274
|
this.__wbg_ptr = ret >>> 0;
|
|
1123
1275
|
WasmConversionOptionsUpdateFinalization.register(this, this.__wbg_ptr, this);
|
|
1124
1276
|
return this;
|
|
@@ -1156,7 +1308,7 @@ export class WasmConversionOptionsUpdate {
|
|
|
1156
1308
|
let v1;
|
|
1157
1309
|
if (r0 !== 0) {
|
|
1158
1310
|
v1 = getArrayJsValueFromWasm0(r0, r1).slice();
|
|
1159
|
-
wasm.
|
|
1311
|
+
wasm.__wbindgen_export4(r0, r1 * 4, 4);
|
|
1160
1312
|
}
|
|
1161
1313
|
return v1;
|
|
1162
1314
|
} finally {
|
|
@@ -1253,6 +1405,14 @@ export class WasmConversionOptionsUpdate {
|
|
|
1253
1405
|
set escapeUnderscores(value) {
|
|
1254
1406
|
wasm.wasmconversionoptionsupdate_set_escapeUnderscores(this.__wbg_ptr, isLikeNone(value) ? 0xFFFFFF : value ? 1 : 0);
|
|
1255
1407
|
}
|
|
1408
|
+
/**
|
|
1409
|
+
* @param {string[] | null} [value]
|
|
1410
|
+
*/
|
|
1411
|
+
set excludeSelectors(value) {
|
|
1412
|
+
var ptr0 = isLikeNone(value) ? 0 : passArrayJsValueToWasm0(value, wasm.__wbindgen_export);
|
|
1413
|
+
var len0 = WASM_VECTOR_LEN;
|
|
1414
|
+
wasm.wasmconversionoptionsupdate_set_excludeSelectors(this.__wbg_ptr, ptr0, len0);
|
|
1415
|
+
}
|
|
1256
1416
|
/**
|
|
1257
1417
|
* @param {boolean | null} [value]
|
|
1258
1418
|
*/
|
|
@@ -1315,6 +1475,12 @@ export class WasmConversionOptionsUpdate {
|
|
|
1315
1475
|
set listIndentWidth(value) {
|
|
1316
1476
|
wasm.wasmconversionoptionsupdate_set_listIndentWidth(this.__wbg_ptr, isLikeNone(value) ? 0x100000001 : (value) >>> 0);
|
|
1317
1477
|
}
|
|
1478
|
+
/**
|
|
1479
|
+
* @param {number | null} [value]
|
|
1480
|
+
*/
|
|
1481
|
+
set maxDepth(value) {
|
|
1482
|
+
wasm.wasmconversionoptionsupdate_set_maxDepth(this.__wbg_ptr, isLikeNone(value) ? 0x100000001 : (value) >>> 0);
|
|
1483
|
+
}
|
|
1318
1484
|
/**
|
|
1319
1485
|
* @param {bigint | null} [value]
|
|
1320
1486
|
*/
|
|
@@ -1440,7 +1606,7 @@ export class WasmConversionOptionsUpdate {
|
|
|
1440
1606
|
let v1;
|
|
1441
1607
|
if (r0 !== 0) {
|
|
1442
1608
|
v1 = getArrayJsValueFromWasm0(r0, r1).slice();
|
|
1443
|
-
wasm.
|
|
1609
|
+
wasm.__wbindgen_export4(r0, r1 * 4, 4);
|
|
1444
1610
|
}
|
|
1445
1611
|
return v1;
|
|
1446
1612
|
} finally {
|
|
@@ -1459,7 +1625,7 @@ export class WasmConversionOptionsUpdate {
|
|
|
1459
1625
|
let v1;
|
|
1460
1626
|
if (r0 !== 0) {
|
|
1461
1627
|
v1 = getStringFromWasm0(r0, r1).slice();
|
|
1462
|
-
wasm.
|
|
1628
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
1463
1629
|
}
|
|
1464
1630
|
return v1;
|
|
1465
1631
|
} finally {
|
|
@@ -1478,7 +1644,7 @@ export class WasmConversionOptionsUpdate {
|
|
|
1478
1644
|
let v1;
|
|
1479
1645
|
if (r0 !== 0) {
|
|
1480
1646
|
v1 = getStringFromWasm0(r0, r1).slice();
|
|
1481
|
-
wasm.
|
|
1647
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
1482
1648
|
}
|
|
1483
1649
|
return v1;
|
|
1484
1650
|
} finally {
|
|
@@ -1497,7 +1663,7 @@ export class WasmConversionOptionsUpdate {
|
|
|
1497
1663
|
let v1;
|
|
1498
1664
|
if (r0 !== 0) {
|
|
1499
1665
|
v1 = getStringFromWasm0(r0, r1).slice();
|
|
1500
|
-
wasm.
|
|
1666
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
1501
1667
|
}
|
|
1502
1668
|
return v1;
|
|
1503
1669
|
} finally {
|
|
@@ -1528,6 +1694,22 @@ export class WasmConversionOptionsUpdate {
|
|
|
1528
1694
|
}
|
|
1529
1695
|
if (Symbol.dispose) WasmConversionOptionsUpdate.prototype[Symbol.dispose] = WasmConversionOptionsUpdate.prototype.free;
|
|
1530
1696
|
|
|
1697
|
+
/**
|
|
1698
|
+
* The primary result of HTML conversion and extraction.
|
|
1699
|
+
*
|
|
1700
|
+
* Contains the converted text output, optional structured document tree,
|
|
1701
|
+
* metadata, extracted tables, images, and processing warnings.
|
|
1702
|
+
*
|
|
1703
|
+
* # Example
|
|
1704
|
+
*
|
|
1705
|
+
* ```text
|
|
1706
|
+
* use html_to_markdown_rs::{convert, ConversionOptions};
|
|
1707
|
+
*
|
|
1708
|
+
* let result = convert("<h1>Hello</h1><p>World</p>", None)?;
|
|
1709
|
+
* assert!(result.content.is_some());
|
|
1710
|
+
* assert!(result.warnings.is_empty());
|
|
1711
|
+
* ```
|
|
1712
|
+
*/
|
|
1531
1713
|
export class WasmConversionResult {
|
|
1532
1714
|
static __wrap(ptr) {
|
|
1533
1715
|
ptr = ptr >>> 0;
|
|
@@ -1558,7 +1740,7 @@ export class WasmConversionResult {
|
|
|
1558
1740
|
let v1;
|
|
1559
1741
|
if (r0 !== 0) {
|
|
1560
1742
|
v1 = getStringFromWasm0(r0, r1).slice();
|
|
1561
|
-
wasm.
|
|
1743
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
1562
1744
|
}
|
|
1563
1745
|
return v1;
|
|
1564
1746
|
} finally {
|
|
@@ -1582,7 +1764,7 @@ export class WasmConversionResult {
|
|
|
1582
1764
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1583
1765
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1584
1766
|
var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
|
|
1585
|
-
wasm.
|
|
1767
|
+
wasm.__wbindgen_export4(r0, r1 * 4, 4);
|
|
1586
1768
|
return v1;
|
|
1587
1769
|
} finally {
|
|
1588
1770
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
@@ -1688,7 +1870,7 @@ export class WasmConversionResult {
|
|
|
1688
1870
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1689
1871
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1690
1872
|
var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
|
|
1691
|
-
wasm.
|
|
1873
|
+
wasm.__wbindgen_export4(r0, r1 * 4, 4);
|
|
1692
1874
|
return v1;
|
|
1693
1875
|
} finally {
|
|
1694
1876
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
@@ -1704,7 +1886,7 @@ export class WasmConversionResult {
|
|
|
1704
1886
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1705
1887
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1706
1888
|
var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
|
|
1707
|
-
wasm.
|
|
1889
|
+
wasm.__wbindgen_export4(r0, r1 * 4, 4);
|
|
1708
1890
|
return v1;
|
|
1709
1891
|
} finally {
|
|
1710
1892
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
@@ -1713,6 +1895,26 @@ export class WasmConversionResult {
|
|
|
1713
1895
|
}
|
|
1714
1896
|
if (Symbol.dispose) WasmConversionResult.prototype[Symbol.dispose] = WasmConversionResult.prototype.free;
|
|
1715
1897
|
|
|
1898
|
+
/**
|
|
1899
|
+
* Document-level metadata extracted from `<head>` and top-level elements.
|
|
1900
|
+
*
|
|
1901
|
+
* Contains all metadata typically used by search engines, social media platforms,
|
|
1902
|
+
* and browsers for document indexing and presentation.
|
|
1903
|
+
*
|
|
1904
|
+
* # Examples
|
|
1905
|
+
*
|
|
1906
|
+
* ```
|
|
1907
|
+
* # use html_to_markdown_rs::metadata::DocumentMetadata;
|
|
1908
|
+
* let doc = DocumentMetadata {
|
|
1909
|
+
* title: Some("My Article".to_string()),
|
|
1910
|
+
* description: Some("A great article about Rust".to_string()),
|
|
1911
|
+
* keywords: vec!["rust".to_string(), "programming".to_string()],
|
|
1912
|
+
* ..Default::default()
|
|
1913
|
+
* };
|
|
1914
|
+
*
|
|
1915
|
+
* assert_eq!(doc.title, Some("My Article".to_string()));
|
|
1916
|
+
* ```
|
|
1917
|
+
*/
|
|
1716
1918
|
export class WasmDocumentMetadata {
|
|
1717
1919
|
static __wrap(ptr) {
|
|
1718
1920
|
ptr = ptr >>> 0;
|
|
@@ -1743,7 +1945,7 @@ export class WasmDocumentMetadata {
|
|
|
1743
1945
|
let v1;
|
|
1744
1946
|
if (r0 !== 0) {
|
|
1745
1947
|
v1 = getStringFromWasm0(r0, r1).slice();
|
|
1746
|
-
wasm.
|
|
1948
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
1747
1949
|
}
|
|
1748
1950
|
return v1;
|
|
1749
1951
|
} finally {
|
|
@@ -1762,7 +1964,7 @@ export class WasmDocumentMetadata {
|
|
|
1762
1964
|
let v1;
|
|
1763
1965
|
if (r0 !== 0) {
|
|
1764
1966
|
v1 = getStringFromWasm0(r0, r1).slice();
|
|
1765
|
-
wasm.
|
|
1967
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
1766
1968
|
}
|
|
1767
1969
|
return v1;
|
|
1768
1970
|
} finally {
|
|
@@ -1781,7 +1983,7 @@ export class WasmDocumentMetadata {
|
|
|
1781
1983
|
let v1;
|
|
1782
1984
|
if (r0 !== 0) {
|
|
1783
1985
|
v1 = getStringFromWasm0(r0, r1).slice();
|
|
1784
|
-
wasm.
|
|
1986
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
1785
1987
|
}
|
|
1786
1988
|
return v1;
|
|
1787
1989
|
} finally {
|
|
@@ -1800,7 +2002,7 @@ export class WasmDocumentMetadata {
|
|
|
1800
2002
|
let v1;
|
|
1801
2003
|
if (r0 !== 0) {
|
|
1802
2004
|
v1 = getStringFromWasm0(r0, r1).slice();
|
|
1803
|
-
wasm.
|
|
2005
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
1804
2006
|
}
|
|
1805
2007
|
return v1;
|
|
1806
2008
|
} finally {
|
|
@@ -1817,7 +2019,7 @@ export class WasmDocumentMetadata {
|
|
|
1817
2019
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1818
2020
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1819
2021
|
var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
|
|
1820
|
-
wasm.
|
|
2022
|
+
wasm.__wbindgen_export4(r0, r1 * 4, 4);
|
|
1821
2023
|
return v1;
|
|
1822
2024
|
} finally {
|
|
1823
2025
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
@@ -1835,7 +2037,7 @@ export class WasmDocumentMetadata {
|
|
|
1835
2037
|
let v1;
|
|
1836
2038
|
if (r0 !== 0) {
|
|
1837
2039
|
v1 = getStringFromWasm0(r0, r1).slice();
|
|
1838
|
-
wasm.
|
|
2040
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
1839
2041
|
}
|
|
1840
2042
|
return v1;
|
|
1841
2043
|
} finally {
|
|
@@ -1988,7 +2190,7 @@ export class WasmDocumentMetadata {
|
|
|
1988
2190
|
let v1;
|
|
1989
2191
|
if (r0 !== 0) {
|
|
1990
2192
|
v1 = getStringFromWasm0(r0, r1).slice();
|
|
1991
|
-
wasm.
|
|
2193
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
1992
2194
|
}
|
|
1993
2195
|
return v1;
|
|
1994
2196
|
} finally {
|
|
@@ -2005,6 +2207,9 @@ export class WasmDocumentMetadata {
|
|
|
2005
2207
|
}
|
|
2006
2208
|
if (Symbol.dispose) WasmDocumentMetadata.prototype[Symbol.dispose] = WasmDocumentMetadata.prototype.free;
|
|
2007
2209
|
|
|
2210
|
+
/**
|
|
2211
|
+
* A single node in the document tree.
|
|
2212
|
+
*/
|
|
2008
2213
|
export class WasmDocumentNode {
|
|
2009
2214
|
static __wrap(ptr) {
|
|
2010
2215
|
ptr = ptr >>> 0;
|
|
@@ -2039,7 +2244,7 @@ export class WasmDocumentNode {
|
|
|
2039
2244
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
2040
2245
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
2041
2246
|
var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
|
|
2042
|
-
wasm.
|
|
2247
|
+
wasm.__wbindgen_export4(r0, r1 * 4, 4);
|
|
2043
2248
|
return v1;
|
|
2044
2249
|
} finally {
|
|
2045
2250
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
@@ -2062,7 +2267,7 @@ export class WasmDocumentNode {
|
|
|
2062
2267
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
2063
2268
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
2064
2269
|
var v1 = getArrayU32FromWasm0(r0, r1).slice();
|
|
2065
|
-
wasm.
|
|
2270
|
+
wasm.__wbindgen_export4(r0, r1 * 4, 4);
|
|
2066
2271
|
return v1;
|
|
2067
2272
|
} finally {
|
|
2068
2273
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
@@ -2091,7 +2296,7 @@ export class WasmDocumentNode {
|
|
|
2091
2296
|
return getStringFromWasm0(r0, r1);
|
|
2092
2297
|
} finally {
|
|
2093
2298
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
2094
|
-
wasm.
|
|
2299
|
+
wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
|
|
2095
2300
|
}
|
|
2096
2301
|
}
|
|
2097
2302
|
/**
|
|
@@ -2166,6 +2371,11 @@ export class WasmDocumentNode {
|
|
|
2166
2371
|
}
|
|
2167
2372
|
if (Symbol.dispose) WasmDocumentNode.prototype[Symbol.dispose] = WasmDocumentNode.prototype.free;
|
|
2168
2373
|
|
|
2374
|
+
/**
|
|
2375
|
+
* A structured document tree representing the semantic content of an HTML document.
|
|
2376
|
+
*
|
|
2377
|
+
* Uses a flat node array with index-based parent/child references for efficient traversal.
|
|
2378
|
+
*/
|
|
2169
2379
|
export class WasmDocumentStructure {
|
|
2170
2380
|
static __wrap(ptr) {
|
|
2171
2381
|
ptr = ptr >>> 0;
|
|
@@ -2208,7 +2418,7 @@ export class WasmDocumentStructure {
|
|
|
2208
2418
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
2209
2419
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
2210
2420
|
var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
|
|
2211
|
-
wasm.
|
|
2421
|
+
wasm.__wbindgen_export4(r0, r1 * 4, 4);
|
|
2212
2422
|
return v1;
|
|
2213
2423
|
} finally {
|
|
2214
2424
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
@@ -2242,7 +2452,7 @@ export class WasmDocumentStructure {
|
|
|
2242
2452
|
let v1;
|
|
2243
2453
|
if (r0 !== 0) {
|
|
2244
2454
|
v1 = getStringFromWasm0(r0, r1).slice();
|
|
2245
|
-
wasm.
|
|
2455
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
2246
2456
|
}
|
|
2247
2457
|
return v1;
|
|
2248
2458
|
} finally {
|
|
@@ -2252,6 +2462,9 @@ export class WasmDocumentStructure {
|
|
|
2252
2462
|
}
|
|
2253
2463
|
if (Symbol.dispose) WasmDocumentStructure.prototype[Symbol.dispose] = WasmDocumentStructure.prototype.free;
|
|
2254
2464
|
|
|
2465
|
+
/**
|
|
2466
|
+
* A single cell in a table grid.
|
|
2467
|
+
*/
|
|
2255
2468
|
export class WasmGridCell {
|
|
2256
2469
|
static __wrap(ptr) {
|
|
2257
2470
|
ptr = ptr >>> 0;
|
|
@@ -2306,7 +2519,7 @@ export class WasmGridCell {
|
|
|
2306
2519
|
return getStringFromWasm0(r0, r1);
|
|
2307
2520
|
} finally {
|
|
2308
2521
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
2309
|
-
wasm.
|
|
2522
|
+
wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
|
|
2310
2523
|
}
|
|
2311
2524
|
}
|
|
2312
2525
|
/**
|
|
@@ -2387,6 +2600,28 @@ export class WasmGridCell {
|
|
|
2387
2600
|
}
|
|
2388
2601
|
if (Symbol.dispose) WasmGridCell.prototype[Symbol.dispose] = WasmGridCell.prototype.free;
|
|
2389
2602
|
|
|
2603
|
+
/**
|
|
2604
|
+
* Header element metadata with hierarchy tracking.
|
|
2605
|
+
*
|
|
2606
|
+
* Captures heading elements (h1-h6) with their text content, identifiers,
|
|
2607
|
+
* and position in the document structure.
|
|
2608
|
+
*
|
|
2609
|
+
* # Examples
|
|
2610
|
+
*
|
|
2611
|
+
* ```
|
|
2612
|
+
* # use html_to_markdown_rs::metadata::HeaderMetadata;
|
|
2613
|
+
* let header = HeaderMetadata {
|
|
2614
|
+
* level: 1,
|
|
2615
|
+
* text: "Main Title".to_string(),
|
|
2616
|
+
* id: Some("main-title".to_string()),
|
|
2617
|
+
* depth: 0,
|
|
2618
|
+
* html_offset: 145,
|
|
2619
|
+
* };
|
|
2620
|
+
*
|
|
2621
|
+
* assert_eq!(header.level, 1);
|
|
2622
|
+
* assert!(header.is_valid());
|
|
2623
|
+
* ```
|
|
2624
|
+
*/
|
|
2390
2625
|
export class WasmHeaderMetadata {
|
|
2391
2626
|
static __wrap(ptr) {
|
|
2392
2627
|
ptr = ptr >>> 0;
|
|
@@ -2437,7 +2672,7 @@ export class WasmHeaderMetadata {
|
|
|
2437
2672
|
let v1;
|
|
2438
2673
|
if (r0 !== 0) {
|
|
2439
2674
|
v1 = getStringFromWasm0(r0, r1).slice();
|
|
2440
|
-
wasm.
|
|
2675
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
2441
2676
|
}
|
|
2442
2677
|
return v1;
|
|
2443
2678
|
} finally {
|
|
@@ -2445,6 +2680,34 @@ export class WasmHeaderMetadata {
|
|
|
2445
2680
|
}
|
|
2446
2681
|
}
|
|
2447
2682
|
/**
|
|
2683
|
+
* Validate that the header level is within valid range (1-6).
|
|
2684
|
+
*
|
|
2685
|
+
* # Returns
|
|
2686
|
+
*
|
|
2687
|
+
* `true` if level is 1-6, `false` otherwise.
|
|
2688
|
+
*
|
|
2689
|
+
* # Examples
|
|
2690
|
+
*
|
|
2691
|
+
* ```
|
|
2692
|
+
* # use html_to_markdown_rs::metadata::HeaderMetadata;
|
|
2693
|
+
* let valid = HeaderMetadata {
|
|
2694
|
+
* level: 3,
|
|
2695
|
+
* text: "Title".to_string(),
|
|
2696
|
+
* id: None,
|
|
2697
|
+
* depth: 2,
|
|
2698
|
+
* html_offset: 100,
|
|
2699
|
+
* };
|
|
2700
|
+
* assert!(valid.is_valid());
|
|
2701
|
+
*
|
|
2702
|
+
* let invalid = HeaderMetadata {
|
|
2703
|
+
* level: 7, // Invalid
|
|
2704
|
+
* text: "Title".to_string(),
|
|
2705
|
+
* id: None,
|
|
2706
|
+
* depth: 2,
|
|
2707
|
+
* html_offset: 100,
|
|
2708
|
+
* };
|
|
2709
|
+
* assert!(!invalid.is_valid());
|
|
2710
|
+
* ```
|
|
2448
2711
|
* @returns {boolean}
|
|
2449
2712
|
*/
|
|
2450
2713
|
isValid() {
|
|
@@ -2525,13 +2788,16 @@ export class WasmHeaderMetadata {
|
|
|
2525
2788
|
return getStringFromWasm0(r0, r1);
|
|
2526
2789
|
} finally {
|
|
2527
2790
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
2528
|
-
wasm.
|
|
2791
|
+
wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
|
|
2529
2792
|
}
|
|
2530
2793
|
}
|
|
2531
2794
|
}
|
|
2532
2795
|
if (Symbol.dispose) WasmHeaderMetadata.prototype[Symbol.dispose] = WasmHeaderMetadata.prototype.free;
|
|
2533
2796
|
|
|
2534
2797
|
/**
|
|
2798
|
+
* Heading style options for Markdown output.
|
|
2799
|
+
*
|
|
2800
|
+
* Controls how headings (h1-h6) are rendered in the output Markdown.
|
|
2535
2801
|
* @enum {0 | 1 | 2}
|
|
2536
2802
|
*/
|
|
2537
2803
|
export const WasmHeadingStyle = Object.freeze({
|
|
@@ -2541,6 +2807,9 @@ export const WasmHeadingStyle = Object.freeze({
|
|
|
2541
2807
|
});
|
|
2542
2808
|
|
|
2543
2809
|
/**
|
|
2810
|
+
* Highlight rendering style for `<mark>` elements.
|
|
2811
|
+
*
|
|
2812
|
+
* Controls how highlighted text is rendered in Markdown output.
|
|
2544
2813
|
* @enum {0 | 1 | 2 | 3}
|
|
2545
2814
|
*/
|
|
2546
2815
|
export const WasmHighlightStyle = Object.freeze({
|
|
@@ -2550,6 +2819,27 @@ export const WasmHighlightStyle = Object.freeze({
|
|
|
2550
2819
|
None: 3, "3": "None",
|
|
2551
2820
|
});
|
|
2552
2821
|
|
|
2822
|
+
/**
|
|
2823
|
+
* Comprehensive metadata extraction result from HTML document.
|
|
2824
|
+
*
|
|
2825
|
+
* Contains all extracted metadata types in a single structure,
|
|
2826
|
+
* suitable for serialization and transmission across language boundaries.
|
|
2827
|
+
*
|
|
2828
|
+
* # Examples
|
|
2829
|
+
*
|
|
2830
|
+
* ```
|
|
2831
|
+
* # use html_to_markdown_rs::metadata::HtmlMetadata;
|
|
2832
|
+
* let metadata = HtmlMetadata {
|
|
2833
|
+
* document: Default::default(),
|
|
2834
|
+
* headers: Vec::new(),
|
|
2835
|
+
* links: Vec::new(),
|
|
2836
|
+
* images: Vec::new(),
|
|
2837
|
+
* structured_data: Vec::new(),
|
|
2838
|
+
* };
|
|
2839
|
+
*
|
|
2840
|
+
* assert!(metadata.headers.is_empty());
|
|
2841
|
+
* ```
|
|
2842
|
+
*/
|
|
2553
2843
|
export class WasmHtmlMetadata {
|
|
2554
2844
|
static __wrap(ptr) {
|
|
2555
2845
|
ptr = ptr >>> 0;
|
|
@@ -2585,7 +2875,7 @@ export class WasmHtmlMetadata {
|
|
|
2585
2875
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
2586
2876
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
2587
2877
|
var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
|
|
2588
|
-
wasm.
|
|
2878
|
+
wasm.__wbindgen_export4(r0, r1 * 4, 4);
|
|
2589
2879
|
return v1;
|
|
2590
2880
|
} finally {
|
|
2591
2881
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
@@ -2601,7 +2891,7 @@ export class WasmHtmlMetadata {
|
|
|
2601
2891
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
2602
2892
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
2603
2893
|
var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
|
|
2604
|
-
wasm.
|
|
2894
|
+
wasm.__wbindgen_export4(r0, r1 * 4, 4);
|
|
2605
2895
|
return v1;
|
|
2606
2896
|
} finally {
|
|
2607
2897
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
@@ -2617,7 +2907,7 @@ export class WasmHtmlMetadata {
|
|
|
2617
2907
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
2618
2908
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
2619
2909
|
var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
|
|
2620
|
-
wasm.
|
|
2910
|
+
wasm.__wbindgen_export4(r0, r1 * 4, 4);
|
|
2621
2911
|
return v1;
|
|
2622
2912
|
} finally {
|
|
2623
2913
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
@@ -2699,7 +2989,7 @@ export class WasmHtmlMetadata {
|
|
|
2699
2989
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
2700
2990
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
2701
2991
|
var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
|
|
2702
|
-
wasm.
|
|
2992
|
+
wasm.__wbindgen_export4(r0, r1 * 4, 4);
|
|
2703
2993
|
return v1;
|
|
2704
2994
|
} finally {
|
|
2705
2995
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
@@ -2708,6 +2998,28 @@ export class WasmHtmlMetadata {
|
|
|
2708
2998
|
}
|
|
2709
2999
|
if (Symbol.dispose) WasmHtmlMetadata.prototype[Symbol.dispose] = WasmHtmlMetadata.prototype.free;
|
|
2710
3000
|
|
|
3001
|
+
/**
|
|
3002
|
+
* Image metadata with source and dimensions.
|
|
3003
|
+
*
|
|
3004
|
+
* Captures `<img>` elements and inline `<svg>` elements with metadata
|
|
3005
|
+
* for image analysis and optimization.
|
|
3006
|
+
*
|
|
3007
|
+
* # Examples
|
|
3008
|
+
*
|
|
3009
|
+
* ```
|
|
3010
|
+
* # use html_to_markdown_rs::metadata::{ImageMetadata, ImageType};
|
|
3011
|
+
* let img = ImageMetadata {
|
|
3012
|
+
* src: "https://example.com/image.jpg".to_string(),
|
|
3013
|
+
* alt: Some("An example image".to_string()),
|
|
3014
|
+
* title: Some("Example".to_string()),
|
|
3015
|
+
* dimensions: Some((800, 600)),
|
|
3016
|
+
* image_type: ImageType::External,
|
|
3017
|
+
* attributes: Default::default(),
|
|
3018
|
+
* };
|
|
3019
|
+
*
|
|
3020
|
+
* assert_eq!(img.image_type, ImageType::External);
|
|
3021
|
+
* ```
|
|
3022
|
+
*/
|
|
2711
3023
|
export class WasmImageMetadata {
|
|
2712
3024
|
static __wrap(ptr) {
|
|
2713
3025
|
ptr = ptr >>> 0;
|
|
@@ -2744,7 +3056,7 @@ export class WasmImageMetadata {
|
|
|
2744
3056
|
let v1;
|
|
2745
3057
|
if (r0 !== 0) {
|
|
2746
3058
|
v1 = getStringFromWasm0(r0, r1).slice();
|
|
2747
|
-
wasm.
|
|
3059
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
2748
3060
|
}
|
|
2749
3061
|
return v1;
|
|
2750
3062
|
} finally {
|
|
@@ -2759,7 +3071,7 @@ export class WasmImageMetadata {
|
|
|
2759
3071
|
return takeObject(ret);
|
|
2760
3072
|
}
|
|
2761
3073
|
/**
|
|
2762
|
-
* @returns {
|
|
3074
|
+
* @returns {Uint32Array | undefined}
|
|
2763
3075
|
*/
|
|
2764
3076
|
get dimensions() {
|
|
2765
3077
|
try {
|
|
@@ -2769,8 +3081,8 @@ export class WasmImageMetadata {
|
|
|
2769
3081
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
2770
3082
|
let v1;
|
|
2771
3083
|
if (r0 !== 0) {
|
|
2772
|
-
v1 =
|
|
2773
|
-
wasm.
|
|
3084
|
+
v1 = getArrayU32FromWasm0(r0, r1).slice();
|
|
3085
|
+
wasm.__wbindgen_export4(r0, r1 * 4, 4);
|
|
2774
3086
|
}
|
|
2775
3087
|
return v1;
|
|
2776
3088
|
} finally {
|
|
@@ -2790,7 +3102,7 @@ export class WasmImageMetadata {
|
|
|
2790
3102
|
* @param {any} attributes
|
|
2791
3103
|
* @param {string | null} [alt]
|
|
2792
3104
|
* @param {string | null} [title]
|
|
2793
|
-
* @param {
|
|
3105
|
+
* @param {Uint32Array | null} [dimensions]
|
|
2794
3106
|
*/
|
|
2795
3107
|
constructor(src, image_type, attributes, alt, title, dimensions) {
|
|
2796
3108
|
const ptr0 = passStringToWasm0(src, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
@@ -2799,7 +3111,7 @@ export class WasmImageMetadata {
|
|
|
2799
3111
|
var len1 = WASM_VECTOR_LEN;
|
|
2800
3112
|
var ptr2 = isLikeNone(title) ? 0 : passStringToWasm0(title, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
2801
3113
|
var len2 = WASM_VECTOR_LEN;
|
|
2802
|
-
var ptr3 = isLikeNone(dimensions) ? 0 :
|
|
3114
|
+
var ptr3 = isLikeNone(dimensions) ? 0 : passArray32ToWasm0(dimensions, wasm.__wbindgen_export);
|
|
2803
3115
|
var len3 = WASM_VECTOR_LEN;
|
|
2804
3116
|
const ret = wasm.wasmimagemetadata_new(ptr0, len0, image_type, addHeapObject(attributes), ptr1, len1, ptr2, len2, ptr3, len3);
|
|
2805
3117
|
this.__wbg_ptr = ret >>> 0;
|
|
@@ -2821,10 +3133,10 @@ export class WasmImageMetadata {
|
|
|
2821
3133
|
wasm.wasmimagemetadata_set_attributes(this.__wbg_ptr, addHeapObject(value));
|
|
2822
3134
|
}
|
|
2823
3135
|
/**
|
|
2824
|
-
* @param {
|
|
3136
|
+
* @param {Uint32Array | null} [value]
|
|
2825
3137
|
*/
|
|
2826
3138
|
set dimensions(value) {
|
|
2827
|
-
var ptr0 = isLikeNone(value) ? 0 :
|
|
3139
|
+
var ptr0 = isLikeNone(value) ? 0 : passArray32ToWasm0(value, wasm.__wbindgen_export);
|
|
2828
3140
|
var len0 = WASM_VECTOR_LEN;
|
|
2829
3141
|
wasm.wasmimagemetadata_set_dimensions(this.__wbg_ptr, ptr0, len0);
|
|
2830
3142
|
}
|
|
@@ -2866,7 +3178,7 @@ export class WasmImageMetadata {
|
|
|
2866
3178
|
return getStringFromWasm0(r0, r1);
|
|
2867
3179
|
} finally {
|
|
2868
3180
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
2869
|
-
wasm.
|
|
3181
|
+
wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
|
|
2870
3182
|
}
|
|
2871
3183
|
}
|
|
2872
3184
|
/**
|
|
@@ -2881,7 +3193,7 @@ export class WasmImageMetadata {
|
|
|
2881
3193
|
let v1;
|
|
2882
3194
|
if (r0 !== 0) {
|
|
2883
3195
|
v1 = getStringFromWasm0(r0, r1).slice();
|
|
2884
|
-
wasm.
|
|
3196
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
2885
3197
|
}
|
|
2886
3198
|
return v1;
|
|
2887
3199
|
} finally {
|
|
@@ -2892,6 +3204,9 @@ export class WasmImageMetadata {
|
|
|
2892
3204
|
if (Symbol.dispose) WasmImageMetadata.prototype[Symbol.dispose] = WasmImageMetadata.prototype.free;
|
|
2893
3205
|
|
|
2894
3206
|
/**
|
|
3207
|
+
* Image source classification for proper handling and processing.
|
|
3208
|
+
*
|
|
3209
|
+
* Determines whether an image is embedded (data URI), inline SVG, external, or relative.
|
|
2895
3210
|
* @enum {0 | 1 | 2 | 3}
|
|
2896
3211
|
*/
|
|
2897
3212
|
export const WasmImageType = Object.freeze({
|
|
@@ -2901,6 +3216,28 @@ export const WasmImageType = Object.freeze({
|
|
|
2901
3216
|
Relative: 3, "3": "Relative",
|
|
2902
3217
|
});
|
|
2903
3218
|
|
|
3219
|
+
/**
|
|
3220
|
+
* Hyperlink metadata with categorization and attributes.
|
|
3221
|
+
*
|
|
3222
|
+
* Represents `<a>` elements with parsed href values, text content, and link type classification.
|
|
3223
|
+
*
|
|
3224
|
+
* # Examples
|
|
3225
|
+
*
|
|
3226
|
+
* ```
|
|
3227
|
+
* # use html_to_markdown_rs::metadata::{LinkMetadata, LinkType};
|
|
3228
|
+
* let link = LinkMetadata {
|
|
3229
|
+
* href: "https://example.com".to_string(),
|
|
3230
|
+
* text: "Example".to_string(),
|
|
3231
|
+
* title: Some("Visit Example".to_string()),
|
|
3232
|
+
* link_type: LinkType::External,
|
|
3233
|
+
* rel: vec!["nofollow".to_string()],
|
|
3234
|
+
* attributes: Default::default(),
|
|
3235
|
+
* };
|
|
3236
|
+
*
|
|
3237
|
+
* assert_eq!(link.link_type, LinkType::External);
|
|
3238
|
+
* assert_eq!(link.text, "Example");
|
|
3239
|
+
* ```
|
|
3240
|
+
*/
|
|
2904
3241
|
export class WasmLinkMetadata {
|
|
2905
3242
|
static __wrap(ptr) {
|
|
2906
3243
|
ptr = ptr >>> 0;
|
|
@@ -2933,6 +3270,25 @@ export class WasmLinkMetadata {
|
|
|
2933
3270
|
return takeObject(ret);
|
|
2934
3271
|
}
|
|
2935
3272
|
/**
|
|
3273
|
+
* Classify a link based on href value.
|
|
3274
|
+
*
|
|
3275
|
+
* # Arguments
|
|
3276
|
+
*
|
|
3277
|
+
* * `href` - The href attribute value
|
|
3278
|
+
*
|
|
3279
|
+
* # Returns
|
|
3280
|
+
*
|
|
3281
|
+
* Appropriate [`LinkType`] based on protocol and content.
|
|
3282
|
+
*
|
|
3283
|
+
* # Examples
|
|
3284
|
+
*
|
|
3285
|
+
* ```
|
|
3286
|
+
* # use html_to_markdown_rs::metadata::{LinkMetadata, LinkType};
|
|
3287
|
+
* assert_eq!(LinkMetadata::classify_link("#section"), LinkType::Anchor);
|
|
3288
|
+
* assert_eq!(LinkMetadata::classify_link("mailto:test@example.com"), LinkType::Email);
|
|
3289
|
+
* assert_eq!(LinkMetadata::classify_link("tel:+1234567890"), LinkType::Phone);
|
|
3290
|
+
* assert_eq!(LinkMetadata::classify_link("https://example.com"), LinkType::External);
|
|
3291
|
+
* ```
|
|
2936
3292
|
* @param {string} href
|
|
2937
3293
|
* @returns {WasmLinkType}
|
|
2938
3294
|
*/
|
|
@@ -2958,7 +3314,7 @@ export class WasmLinkMetadata {
|
|
|
2958
3314
|
return getStringFromWasm0(r0, r1);
|
|
2959
3315
|
} finally {
|
|
2960
3316
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
2961
|
-
wasm.
|
|
3317
|
+
wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
|
|
2962
3318
|
}
|
|
2963
3319
|
}
|
|
2964
3320
|
/**
|
|
@@ -3000,7 +3356,7 @@ export class WasmLinkMetadata {
|
|
|
3000
3356
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
3001
3357
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
3002
3358
|
var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
|
|
3003
|
-
wasm.
|
|
3359
|
+
wasm.__wbindgen_export4(r0, r1 * 4, 4);
|
|
3004
3360
|
return v1;
|
|
3005
3361
|
} finally {
|
|
3006
3362
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
@@ -3066,7 +3422,7 @@ export class WasmLinkMetadata {
|
|
|
3066
3422
|
return getStringFromWasm0(r0, r1);
|
|
3067
3423
|
} finally {
|
|
3068
3424
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
3069
|
-
wasm.
|
|
3425
|
+
wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
|
|
3070
3426
|
}
|
|
3071
3427
|
}
|
|
3072
3428
|
/**
|
|
@@ -3081,7 +3437,7 @@ export class WasmLinkMetadata {
|
|
|
3081
3437
|
let v1;
|
|
3082
3438
|
if (r0 !== 0) {
|
|
3083
3439
|
v1 = getStringFromWasm0(r0, r1).slice();
|
|
3084
|
-
wasm.
|
|
3440
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
3085
3441
|
}
|
|
3086
3442
|
return v1;
|
|
3087
3443
|
} finally {
|
|
@@ -3092,6 +3448,10 @@ export class WasmLinkMetadata {
|
|
|
3092
3448
|
if (Symbol.dispose) WasmLinkMetadata.prototype[Symbol.dispose] = WasmLinkMetadata.prototype.free;
|
|
3093
3449
|
|
|
3094
3450
|
/**
|
|
3451
|
+
* Link rendering style in Markdown output.
|
|
3452
|
+
*
|
|
3453
|
+
* Controls whether links and images use inline `[text](url)` syntax or
|
|
3454
|
+
* reference-style `[text][1]` syntax with definitions collected at the end.
|
|
3095
3455
|
* @enum {0 | 1}
|
|
3096
3456
|
*/
|
|
3097
3457
|
export const WasmLinkStyle = Object.freeze({
|
|
@@ -3100,6 +3460,9 @@ export const WasmLinkStyle = Object.freeze({
|
|
|
3100
3460
|
});
|
|
3101
3461
|
|
|
3102
3462
|
/**
|
|
3463
|
+
* Link classification based on href value and document context.
|
|
3464
|
+
*
|
|
3465
|
+
* Used to categorize links during extraction for filtering and analysis.
|
|
3103
3466
|
* @enum {0 | 1 | 2 | 3 | 4 | 5}
|
|
3104
3467
|
*/
|
|
3105
3468
|
export const WasmLinkType = Object.freeze({
|
|
@@ -3112,6 +3475,9 @@ export const WasmLinkType = Object.freeze({
|
|
|
3112
3475
|
});
|
|
3113
3476
|
|
|
3114
3477
|
/**
|
|
3478
|
+
* List indentation character type.
|
|
3479
|
+
*
|
|
3480
|
+
* Controls whether list items are indented with spaces or tabs.
|
|
3115
3481
|
* @enum {0 | 1}
|
|
3116
3482
|
*/
|
|
3117
3483
|
export const WasmListIndentType = Object.freeze({
|
|
@@ -3119,267 +3485,299 @@ export const WasmListIndentType = Object.freeze({
|
|
|
3119
3485
|
Tabs: 1, "1": "Tabs",
|
|
3120
3486
|
});
|
|
3121
3487
|
|
|
3122
|
-
|
|
3123
|
-
|
|
3124
|
-
|
|
3125
|
-
|
|
3126
|
-
|
|
3127
|
-
|
|
3128
|
-
|
|
3129
|
-
|
|
3488
|
+
/**
|
|
3489
|
+
* Line break syntax in Markdown output.
|
|
3490
|
+
*
|
|
3491
|
+
* Controls how soft line breaks (from `<br>` or line breaks in source) are rendered.
|
|
3492
|
+
* @enum {0 | 1}
|
|
3493
|
+
*/
|
|
3494
|
+
export const WasmNewlineStyle = Object.freeze({
|
|
3495
|
+
Spaces: 0, "0": "Spaces",
|
|
3496
|
+
Backslash: 1, "1": "Backslash",
|
|
3497
|
+
});
|
|
3498
|
+
|
|
3499
|
+
/**
|
|
3500
|
+
* The semantic content type of a document node.
|
|
3501
|
+
*
|
|
3502
|
+
* Uses internally tagged representation (`"node_type": "heading"`) for JSON serialization.
|
|
3503
|
+
* @enum {0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12}
|
|
3504
|
+
*/
|
|
3505
|
+
export const WasmNodeContent = Object.freeze({
|
|
3506
|
+
Heading: 0, "0": "Heading",
|
|
3507
|
+
Paragraph: 1, "1": "Paragraph",
|
|
3508
|
+
List: 2, "2": "List",
|
|
3509
|
+
ListItem: 3, "3": "ListItem",
|
|
3510
|
+
Table: 4, "4": "Table",
|
|
3511
|
+
Image: 5, "5": "Image",
|
|
3512
|
+
Code: 6, "6": "Code",
|
|
3513
|
+
Quote: 7, "7": "Quote",
|
|
3514
|
+
DefinitionList: 8, "8": "DefinitionList",
|
|
3515
|
+
DefinitionItem: 9, "9": "DefinitionItem",
|
|
3516
|
+
RawBlock: 10, "10": "RawBlock",
|
|
3517
|
+
MetadataBlock: 11, "11": "MetadataBlock",
|
|
3518
|
+
Group: 12, "12": "Group",
|
|
3519
|
+
});
|
|
3520
|
+
|
|
3521
|
+
/**
|
|
3522
|
+
* Context information passed to all visitor methods.
|
|
3523
|
+
*
|
|
3524
|
+
* Provides comprehensive metadata about the current node being visited,
|
|
3525
|
+
* including its type, attributes, position in the DOM tree, and parent context.
|
|
3526
|
+
*/
|
|
3527
|
+
export class WasmNodeContext {
|
|
3130
3528
|
__destroy_into_raw() {
|
|
3131
3529
|
const ptr = this.__wbg_ptr;
|
|
3132
3530
|
this.__wbg_ptr = 0;
|
|
3133
|
-
|
|
3531
|
+
WasmNodeContextFinalization.unregister(this);
|
|
3134
3532
|
return ptr;
|
|
3135
3533
|
}
|
|
3136
3534
|
free() {
|
|
3137
3535
|
const ptr = this.__destroy_into_raw();
|
|
3138
|
-
wasm.
|
|
3139
|
-
}
|
|
3140
|
-
/**
|
|
3141
|
-
* @returns {boolean}
|
|
3142
|
-
*/
|
|
3143
|
-
anyEnabled() {
|
|
3144
|
-
const ret = wasm.wasmmetadataconfig_anyEnabled(this.__wbg_ptr);
|
|
3145
|
-
return ret !== 0;
|
|
3536
|
+
wasm.__wbg_wasmnodecontext_free(ptr, 0);
|
|
3146
3537
|
}
|
|
3147
3538
|
/**
|
|
3148
|
-
* @returns {
|
|
3149
|
-
*/
|
|
3150
|
-
static default() {
|
|
3151
|
-
const ret = wasm.wasmmetadataconfig_default();
|
|
3152
|
-
return WasmMetadataConfig.__wrap(ret);
|
|
3153
|
-
}
|
|
3154
|
-
/**
|
|
3155
|
-
* @returns {boolean}
|
|
3156
|
-
*/
|
|
3157
|
-
get extractDocument() {
|
|
3158
|
-
const ret = wasm.wasmmetadataconfig_extractDocument(this.__wbg_ptr);
|
|
3159
|
-
return ret !== 0;
|
|
3160
|
-
}
|
|
3161
|
-
/**
|
|
3162
|
-
* @returns {boolean}
|
|
3539
|
+
* @returns {WasmConversionResult}
|
|
3163
3540
|
*/
|
|
3164
|
-
get
|
|
3165
|
-
const ret = wasm.
|
|
3166
|
-
return ret
|
|
3541
|
+
get attributes() {
|
|
3542
|
+
const ret = wasm.wasmnodecontext_attributes(this.__wbg_ptr);
|
|
3543
|
+
return takeObject(ret);
|
|
3167
3544
|
}
|
|
3168
3545
|
/**
|
|
3169
|
-
* @returns {
|
|
3546
|
+
* @returns {number}
|
|
3170
3547
|
*/
|
|
3171
|
-
get
|
|
3172
|
-
const ret = wasm.
|
|
3173
|
-
return ret
|
|
3548
|
+
get depth() {
|
|
3549
|
+
const ret = wasm.wasmnodecontext_depth(this.__wbg_ptr);
|
|
3550
|
+
return ret >>> 0;
|
|
3174
3551
|
}
|
|
3175
3552
|
/**
|
|
3176
|
-
* @returns {
|
|
3553
|
+
* @returns {number}
|
|
3177
3554
|
*/
|
|
3178
|
-
get
|
|
3179
|
-
const ret = wasm.
|
|
3180
|
-
return ret
|
|
3555
|
+
get indexInParent() {
|
|
3556
|
+
const ret = wasm.wasmnodecontext_indexInParent(this.__wbg_ptr);
|
|
3557
|
+
return ret >>> 0;
|
|
3181
3558
|
}
|
|
3182
3559
|
/**
|
|
3183
3560
|
* @returns {boolean}
|
|
3184
3561
|
*/
|
|
3185
|
-
get
|
|
3186
|
-
const ret = wasm.
|
|
3562
|
+
get isInline() {
|
|
3563
|
+
const ret = wasm.wasmnodecontext_isInline(this.__wbg_ptr);
|
|
3187
3564
|
return ret !== 0;
|
|
3188
3565
|
}
|
|
3189
3566
|
/**
|
|
3190
|
-
* @
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
|
|
3197
|
-
* @param {boolean | null} [extract_document]
|
|
3198
|
-
* @param {boolean | null} [extract_headers]
|
|
3199
|
-
* @param {boolean | null} [extract_links]
|
|
3200
|
-
* @param {boolean | null} [extract_images]
|
|
3201
|
-
* @param {boolean | null} [extract_structured_data]
|
|
3202
|
-
* @param {number | null} [max_structured_data_size]
|
|
3567
|
+
* @param {WasmNodeType} node_type
|
|
3568
|
+
* @param {string} tag_name
|
|
3569
|
+
* @param {any} attributes
|
|
3570
|
+
* @param {number} depth
|
|
3571
|
+
* @param {number} index_in_parent
|
|
3572
|
+
* @param {boolean} is_inline
|
|
3573
|
+
* @param {string | null} [parent_tag]
|
|
3203
3574
|
*/
|
|
3204
|
-
constructor(
|
|
3205
|
-
const
|
|
3575
|
+
constructor(node_type, tag_name, attributes, depth, index_in_parent, is_inline, parent_tag) {
|
|
3576
|
+
const ptr0 = passStringToWasm0(tag_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
3577
|
+
const len0 = WASM_VECTOR_LEN;
|
|
3578
|
+
var ptr1 = isLikeNone(parent_tag) ? 0 : passStringToWasm0(parent_tag, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
3579
|
+
var len1 = WASM_VECTOR_LEN;
|
|
3580
|
+
const ret = wasm.wasmnodecontext_new(node_type, ptr0, len0, addHeapObject(attributes), depth, index_in_parent, is_inline, ptr1, len1);
|
|
3206
3581
|
this.__wbg_ptr = ret >>> 0;
|
|
3207
|
-
|
|
3582
|
+
WasmNodeContextFinalization.register(this, this.__wbg_ptr, this);
|
|
3208
3583
|
return this;
|
|
3209
3584
|
}
|
|
3210
3585
|
/**
|
|
3211
|
-
* @
|
|
3212
|
-
*/
|
|
3213
|
-
set extractDocument(value) {
|
|
3214
|
-
wasm.wasmmetadataconfig_set_extractDocument(this.__wbg_ptr, value);
|
|
3215
|
-
}
|
|
3216
|
-
/**
|
|
3217
|
-
* @param {boolean} value
|
|
3218
|
-
*/
|
|
3219
|
-
set extractHeaders(value) {
|
|
3220
|
-
wasm.wasmmetadataconfig_set_extractHeaders(this.__wbg_ptr, value);
|
|
3221
|
-
}
|
|
3222
|
-
/**
|
|
3223
|
-
* @param {boolean} value
|
|
3586
|
+
* @returns {WasmNodeType}
|
|
3224
3587
|
*/
|
|
3225
|
-
|
|
3226
|
-
wasm.
|
|
3588
|
+
get nodeType() {
|
|
3589
|
+
const ret = wasm.wasmnodecontext_nodeType(this.__wbg_ptr);
|
|
3590
|
+
return ret;
|
|
3227
3591
|
}
|
|
3228
3592
|
/**
|
|
3229
|
-
* @
|
|
3593
|
+
* @returns {string | undefined}
|
|
3230
3594
|
*/
|
|
3231
|
-
|
|
3232
|
-
|
|
3595
|
+
get parentTag() {
|
|
3596
|
+
try {
|
|
3597
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
3598
|
+
wasm.wasmnodecontext_parentTag(retptr, this.__wbg_ptr);
|
|
3599
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
3600
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
3601
|
+
let v1;
|
|
3602
|
+
if (r0 !== 0) {
|
|
3603
|
+
v1 = getStringFromWasm0(r0, r1).slice();
|
|
3604
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
3605
|
+
}
|
|
3606
|
+
return v1;
|
|
3607
|
+
} finally {
|
|
3608
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
3609
|
+
}
|
|
3233
3610
|
}
|
|
3234
3611
|
/**
|
|
3235
|
-
* @param {
|
|
3612
|
+
* @param {any} value
|
|
3236
3613
|
*/
|
|
3237
|
-
set
|
|
3238
|
-
wasm.
|
|
3614
|
+
set attributes(value) {
|
|
3615
|
+
wasm.wasmnodecontext_set_attributes(this.__wbg_ptr, addHeapObject(value));
|
|
3239
3616
|
}
|
|
3240
3617
|
/**
|
|
3241
3618
|
* @param {number} value
|
|
3242
3619
|
*/
|
|
3243
|
-
set
|
|
3244
|
-
wasm.
|
|
3245
|
-
}
|
|
3246
|
-
}
|
|
3247
|
-
if (Symbol.dispose) WasmMetadataConfig.prototype[Symbol.dispose] = WasmMetadataConfig.prototype.free;
|
|
3248
|
-
|
|
3249
|
-
export class WasmMetadataConfigUpdate {
|
|
3250
|
-
__destroy_into_raw() {
|
|
3251
|
-
const ptr = this.__wbg_ptr;
|
|
3252
|
-
this.__wbg_ptr = 0;
|
|
3253
|
-
WasmMetadataConfigUpdateFinalization.unregister(this);
|
|
3254
|
-
return ptr;
|
|
3255
|
-
}
|
|
3256
|
-
free() {
|
|
3257
|
-
const ptr = this.__destroy_into_raw();
|
|
3258
|
-
wasm.__wbg_wasmmetadataconfigupdate_free(ptr, 0);
|
|
3259
|
-
}
|
|
3260
|
-
/**
|
|
3261
|
-
* @returns {boolean | undefined}
|
|
3262
|
-
*/
|
|
3263
|
-
get extractDocument() {
|
|
3264
|
-
const ret = wasm.wasmmetadataconfigupdate_extractDocument(this.__wbg_ptr);
|
|
3265
|
-
return ret === 0xFFFFFF ? undefined : ret !== 0;
|
|
3266
|
-
}
|
|
3267
|
-
/**
|
|
3268
|
-
* @returns {boolean | undefined}
|
|
3269
|
-
*/
|
|
3270
|
-
get extractHeaders() {
|
|
3271
|
-
const ret = wasm.wasmmetadataconfigupdate_extractHeaders(this.__wbg_ptr);
|
|
3272
|
-
return ret === 0xFFFFFF ? undefined : ret !== 0;
|
|
3273
|
-
}
|
|
3274
|
-
/**
|
|
3275
|
-
* @returns {boolean | undefined}
|
|
3276
|
-
*/
|
|
3277
|
-
get extractImages() {
|
|
3278
|
-
const ret = wasm.wasmmetadataconfigupdate_extractImages(this.__wbg_ptr);
|
|
3279
|
-
return ret === 0xFFFFFF ? undefined : ret !== 0;
|
|
3280
|
-
}
|
|
3281
|
-
/**
|
|
3282
|
-
* @returns {boolean | undefined}
|
|
3283
|
-
*/
|
|
3284
|
-
get extractLinks() {
|
|
3285
|
-
const ret = wasm.wasmmetadataconfigupdate_extractLinks(this.__wbg_ptr);
|
|
3286
|
-
return ret === 0xFFFFFF ? undefined : ret !== 0;
|
|
3287
|
-
}
|
|
3288
|
-
/**
|
|
3289
|
-
* @returns {boolean | undefined}
|
|
3290
|
-
*/
|
|
3291
|
-
get extractStructuredData() {
|
|
3292
|
-
const ret = wasm.wasmmetadataconfigupdate_extractStructuredData(this.__wbg_ptr);
|
|
3293
|
-
return ret === 0xFFFFFF ? undefined : ret !== 0;
|
|
3294
|
-
}
|
|
3295
|
-
/**
|
|
3296
|
-
* @returns {number | undefined}
|
|
3297
|
-
*/
|
|
3298
|
-
get maxStructuredDataSize() {
|
|
3299
|
-
const ret = wasm.wasmmetadataconfigupdate_maxStructuredDataSize(this.__wbg_ptr);
|
|
3300
|
-
return ret === 0x100000001 ? undefined : ret;
|
|
3301
|
-
}
|
|
3302
|
-
/**
|
|
3303
|
-
* @param {boolean | null} [extract_document]
|
|
3304
|
-
* @param {boolean | null} [extract_headers]
|
|
3305
|
-
* @param {boolean | null} [extract_links]
|
|
3306
|
-
* @param {boolean | null} [extract_images]
|
|
3307
|
-
* @param {boolean | null} [extract_structured_data]
|
|
3308
|
-
* @param {number | null} [max_structured_data_size]
|
|
3309
|
-
*/
|
|
3310
|
-
constructor(extract_document, extract_headers, extract_links, extract_images, extract_structured_data, max_structured_data_size) {
|
|
3311
|
-
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);
|
|
3312
|
-
this.__wbg_ptr = ret >>> 0;
|
|
3313
|
-
WasmMetadataConfigUpdateFinalization.register(this, this.__wbg_ptr, this);
|
|
3314
|
-
return this;
|
|
3620
|
+
set depth(value) {
|
|
3621
|
+
wasm.wasmnodecontext_set_depth(this.__wbg_ptr, value);
|
|
3315
3622
|
}
|
|
3316
3623
|
/**
|
|
3317
|
-
* @param {
|
|
3624
|
+
* @param {number} value
|
|
3318
3625
|
*/
|
|
3319
|
-
set
|
|
3320
|
-
wasm.
|
|
3626
|
+
set indexInParent(value) {
|
|
3627
|
+
wasm.wasmnodecontext_set_indexInParent(this.__wbg_ptr, value);
|
|
3321
3628
|
}
|
|
3322
3629
|
/**
|
|
3323
|
-
* @param {boolean
|
|
3630
|
+
* @param {boolean} value
|
|
3324
3631
|
*/
|
|
3325
|
-
set
|
|
3326
|
-
wasm.
|
|
3632
|
+
set isInline(value) {
|
|
3633
|
+
wasm.wasmnodecontext_set_isInline(this.__wbg_ptr, value);
|
|
3327
3634
|
}
|
|
3328
3635
|
/**
|
|
3329
|
-
* @param {
|
|
3636
|
+
* @param {WasmNodeType} value
|
|
3330
3637
|
*/
|
|
3331
|
-
set
|
|
3332
|
-
wasm.
|
|
3638
|
+
set nodeType(value) {
|
|
3639
|
+
wasm.wasmnodecontext_set_nodeType(this.__wbg_ptr, value);
|
|
3333
3640
|
}
|
|
3334
3641
|
/**
|
|
3335
|
-
* @param {
|
|
3642
|
+
* @param {string | null} [value]
|
|
3336
3643
|
*/
|
|
3337
|
-
set
|
|
3338
|
-
|
|
3644
|
+
set parentTag(value) {
|
|
3645
|
+
var ptr0 = isLikeNone(value) ? 0 : passStringToWasm0(value, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
3646
|
+
var len0 = WASM_VECTOR_LEN;
|
|
3647
|
+
wasm.wasmnodecontext_set_parentTag(this.__wbg_ptr, ptr0, len0);
|
|
3339
3648
|
}
|
|
3340
3649
|
/**
|
|
3341
|
-
* @param {
|
|
3650
|
+
* @param {string} value
|
|
3342
3651
|
*/
|
|
3343
|
-
set
|
|
3344
|
-
|
|
3652
|
+
set tagName(value) {
|
|
3653
|
+
const ptr0 = passStringToWasm0(value, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
3654
|
+
const len0 = WASM_VECTOR_LEN;
|
|
3655
|
+
wasm.wasmnodecontext_set_tagName(this.__wbg_ptr, ptr0, len0);
|
|
3345
3656
|
}
|
|
3346
3657
|
/**
|
|
3347
|
-
* @
|
|
3658
|
+
* @returns {string}
|
|
3348
3659
|
*/
|
|
3349
|
-
|
|
3350
|
-
|
|
3660
|
+
get tagName() {
|
|
3661
|
+
let deferred1_0;
|
|
3662
|
+
let deferred1_1;
|
|
3663
|
+
try {
|
|
3664
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
3665
|
+
wasm.wasmnodecontext_tagName(retptr, this.__wbg_ptr);
|
|
3666
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
3667
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
3668
|
+
deferred1_0 = r0;
|
|
3669
|
+
deferred1_1 = r1;
|
|
3670
|
+
return getStringFromWasm0(r0, r1);
|
|
3671
|
+
} finally {
|
|
3672
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
3673
|
+
wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
|
|
3674
|
+
}
|
|
3351
3675
|
}
|
|
3352
3676
|
}
|
|
3353
|
-
if (Symbol.dispose)
|
|
3354
|
-
|
|
3355
|
-
/**
|
|
3356
|
-
* @enum {0 | 1}
|
|
3357
|
-
*/
|
|
3358
|
-
export const WasmNewlineStyle = Object.freeze({
|
|
3359
|
-
Spaces: 0, "0": "Spaces",
|
|
3360
|
-
Backslash: 1, "1": "Backslash",
|
|
3361
|
-
});
|
|
3677
|
+
if (Symbol.dispose) WasmNodeContext.prototype[Symbol.dispose] = WasmNodeContext.prototype.free;
|
|
3362
3678
|
|
|
3363
3679
|
/**
|
|
3364
|
-
*
|
|
3680
|
+
* Node type enumeration covering all HTML element types.
|
|
3681
|
+
*
|
|
3682
|
+
* This enum categorizes all HTML elements that the converter recognizes,
|
|
3683
|
+
* providing a coarse-grained classification for visitor dispatch.
|
|
3684
|
+
* @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}
|
|
3365
3685
|
*/
|
|
3366
|
-
export const
|
|
3367
|
-
|
|
3368
|
-
|
|
3369
|
-
|
|
3370
|
-
|
|
3371
|
-
|
|
3372
|
-
|
|
3373
|
-
|
|
3374
|
-
|
|
3375
|
-
|
|
3376
|
-
|
|
3377
|
-
|
|
3378
|
-
|
|
3379
|
-
|
|
3686
|
+
export const WasmNodeType = Object.freeze({
|
|
3687
|
+
Text: 0, "0": "Text",
|
|
3688
|
+
Element: 1, "1": "Element",
|
|
3689
|
+
Heading: 2, "2": "Heading",
|
|
3690
|
+
Paragraph: 3, "3": "Paragraph",
|
|
3691
|
+
Div: 4, "4": "Div",
|
|
3692
|
+
Blockquote: 5, "5": "Blockquote",
|
|
3693
|
+
Pre: 6, "6": "Pre",
|
|
3694
|
+
Hr: 7, "7": "Hr",
|
|
3695
|
+
List: 8, "8": "List",
|
|
3696
|
+
ListItem: 9, "9": "ListItem",
|
|
3697
|
+
DefinitionList: 10, "10": "DefinitionList",
|
|
3698
|
+
DefinitionTerm: 11, "11": "DefinitionTerm",
|
|
3699
|
+
DefinitionDescription: 12, "12": "DefinitionDescription",
|
|
3700
|
+
Table: 13, "13": "Table",
|
|
3701
|
+
TableRow: 14, "14": "TableRow",
|
|
3702
|
+
TableCell: 15, "15": "TableCell",
|
|
3703
|
+
TableHeader: 16, "16": "TableHeader",
|
|
3704
|
+
TableBody: 17, "17": "TableBody",
|
|
3705
|
+
TableHead: 18, "18": "TableHead",
|
|
3706
|
+
TableFoot: 19, "19": "TableFoot",
|
|
3707
|
+
Link: 20, "20": "Link",
|
|
3708
|
+
Image: 21, "21": "Image",
|
|
3709
|
+
Strong: 22, "22": "Strong",
|
|
3710
|
+
Em: 23, "23": "Em",
|
|
3711
|
+
Code: 24, "24": "Code",
|
|
3712
|
+
Strikethrough: 25, "25": "Strikethrough",
|
|
3713
|
+
Underline: 26, "26": "Underline",
|
|
3714
|
+
Subscript: 27, "27": "Subscript",
|
|
3715
|
+
Superscript: 28, "28": "Superscript",
|
|
3716
|
+
Mark: 29, "29": "Mark",
|
|
3717
|
+
Small: 30, "30": "Small",
|
|
3718
|
+
Br: 31, "31": "Br",
|
|
3719
|
+
Span: 32, "32": "Span",
|
|
3720
|
+
Article: 33, "33": "Article",
|
|
3721
|
+
Section: 34, "34": "Section",
|
|
3722
|
+
Nav: 35, "35": "Nav",
|
|
3723
|
+
Aside: 36, "36": "Aside",
|
|
3724
|
+
Header: 37, "37": "Header",
|
|
3725
|
+
Footer: 38, "38": "Footer",
|
|
3726
|
+
Main: 39, "39": "Main",
|
|
3727
|
+
Figure: 40, "40": "Figure",
|
|
3728
|
+
Figcaption: 41, "41": "Figcaption",
|
|
3729
|
+
Time: 42, "42": "Time",
|
|
3730
|
+
Details: 43, "43": "Details",
|
|
3731
|
+
Summary: 44, "44": "Summary",
|
|
3732
|
+
Form: 45, "45": "Form",
|
|
3733
|
+
Input: 46, "46": "Input",
|
|
3734
|
+
Select: 47, "47": "Select",
|
|
3735
|
+
Option: 48, "48": "Option",
|
|
3736
|
+
Button: 49, "49": "Button",
|
|
3737
|
+
Textarea: 50, "50": "Textarea",
|
|
3738
|
+
Label: 51, "51": "Label",
|
|
3739
|
+
Fieldset: 52, "52": "Fieldset",
|
|
3740
|
+
Legend: 53, "53": "Legend",
|
|
3741
|
+
Audio: 54, "54": "Audio",
|
|
3742
|
+
Video: 55, "55": "Video",
|
|
3743
|
+
Picture: 56, "56": "Picture",
|
|
3744
|
+
Source: 57, "57": "Source",
|
|
3745
|
+
Iframe: 58, "58": "Iframe",
|
|
3746
|
+
Svg: 59, "59": "Svg",
|
|
3747
|
+
Canvas: 60, "60": "Canvas",
|
|
3748
|
+
Ruby: 61, "61": "Ruby",
|
|
3749
|
+
Rt: 62, "62": "Rt",
|
|
3750
|
+
Rp: 63, "63": "Rp",
|
|
3751
|
+
Abbr: 64, "64": "Abbr",
|
|
3752
|
+
Kbd: 65, "65": "Kbd",
|
|
3753
|
+
Samp: 66, "66": "Samp",
|
|
3754
|
+
Var: 67, "67": "Var",
|
|
3755
|
+
Cite: 68, "68": "Cite",
|
|
3756
|
+
Q: 69, "69": "Q",
|
|
3757
|
+
Del: 70, "70": "Del",
|
|
3758
|
+
Ins: 71, "71": "Ins",
|
|
3759
|
+
Data: 72, "72": "Data",
|
|
3760
|
+
Meter: 73, "73": "Meter",
|
|
3761
|
+
Progress: 74, "74": "Progress",
|
|
3762
|
+
Output: 75, "75": "Output",
|
|
3763
|
+
Template: 76, "76": "Template",
|
|
3764
|
+
Slot: 77, "77": "Slot",
|
|
3765
|
+
Html: 78, "78": "Html",
|
|
3766
|
+
Head: 79, "79": "Head",
|
|
3767
|
+
Body: 80, "80": "Body",
|
|
3768
|
+
Title: 81, "81": "Title",
|
|
3769
|
+
Meta: 82, "82": "Meta",
|
|
3770
|
+
LinkTag: 83, "83": "LinkTag",
|
|
3771
|
+
Style: 84, "84": "Style",
|
|
3772
|
+
Script: 85, "85": "Script",
|
|
3773
|
+
Base: 86, "86": "Base",
|
|
3774
|
+
Custom: 87, "87": "Custom",
|
|
3380
3775
|
});
|
|
3381
3776
|
|
|
3382
3777
|
/**
|
|
3778
|
+
* Output format for conversion.
|
|
3779
|
+
*
|
|
3780
|
+
* Specifies the target markup language format for the conversion output.
|
|
3383
3781
|
* @enum {0 | 1 | 2}
|
|
3384
3782
|
*/
|
|
3385
3783
|
export const WasmOutputFormat = Object.freeze({
|
|
@@ -3388,6 +3786,9 @@ export const WasmOutputFormat = Object.freeze({
|
|
|
3388
3786
|
Plain: 2, "2": "Plain",
|
|
3389
3787
|
});
|
|
3390
3788
|
|
|
3789
|
+
/**
|
|
3790
|
+
* HTML preprocessing options for document cleanup before conversion.
|
|
3791
|
+
*/
|
|
3391
3792
|
export class WasmPreprocessingOptions {
|
|
3392
3793
|
static __wrap(ptr) {
|
|
3393
3794
|
ptr = ptr >>> 0;
|
|
@@ -3406,6 +3807,22 @@ export class WasmPreprocessingOptions {
|
|
|
3406
3807
|
const ptr = this.__destroy_into_raw();
|
|
3407
3808
|
wasm.__wbg_wasmpreprocessingoptions_free(ptr, 0);
|
|
3408
3809
|
}
|
|
3810
|
+
/**
|
|
3811
|
+
* Apply a partial update to these preprocessing options.
|
|
3812
|
+
*
|
|
3813
|
+
* Any specified fields in the update will override the current values.
|
|
3814
|
+
* Unspecified fields (None) are left unchanged.
|
|
3815
|
+
*
|
|
3816
|
+
* # Arguments
|
|
3817
|
+
*
|
|
3818
|
+
* * `update` - Partial preprocessing options update
|
|
3819
|
+
* @param {WasmPreprocessingOptionsUpdate} _update
|
|
3820
|
+
*/
|
|
3821
|
+
applyUpdate(_update) {
|
|
3822
|
+
_assertClass(_update, WasmPreprocessingOptionsUpdate);
|
|
3823
|
+
var ptr0 = _update.__destroy_into_raw();
|
|
3824
|
+
wasm.wasmpreprocessingoptions_applyUpdate(this.__wbg_ptr, ptr0);
|
|
3825
|
+
}
|
|
3409
3826
|
/**
|
|
3410
3827
|
* @returns {WasmPreprocessingOptions}
|
|
3411
3828
|
*/
|
|
@@ -3420,6 +3837,38 @@ export class WasmPreprocessingOptions {
|
|
|
3420
3837
|
const ret = wasm.wasmpreprocessingoptions_enabled(this.__wbg_ptr);
|
|
3421
3838
|
return ret !== 0;
|
|
3422
3839
|
}
|
|
3840
|
+
/**
|
|
3841
|
+
* @param {WasmPreprocessingOptionsUpdate} update
|
|
3842
|
+
* @returns {WasmPreprocessingOptions}
|
|
3843
|
+
*/
|
|
3844
|
+
static from(update) {
|
|
3845
|
+
_assertClass(update, WasmPreprocessingOptionsUpdate);
|
|
3846
|
+
var ptr0 = update.__destroy_into_raw();
|
|
3847
|
+
const ret = wasm.wasmpreprocessingoptions_from(ptr0);
|
|
3848
|
+
return WasmPreprocessingOptions.__wrap(ret);
|
|
3849
|
+
}
|
|
3850
|
+
/**
|
|
3851
|
+
* Create new preprocessing options from a partial update.
|
|
3852
|
+
*
|
|
3853
|
+
* Creates a new `PreprocessingOptions` struct with defaults, then applies the update.
|
|
3854
|
+
* Fields not specified in the update keep their default values.
|
|
3855
|
+
*
|
|
3856
|
+
* # Arguments
|
|
3857
|
+
*
|
|
3858
|
+
* * `update` - Partial preprocessing options update
|
|
3859
|
+
*
|
|
3860
|
+
* # Returns
|
|
3861
|
+
*
|
|
3862
|
+
* New `PreprocessingOptions` with specified updates applied to defaults
|
|
3863
|
+
* @param {WasmPreprocessingOptionsUpdate} update
|
|
3864
|
+
* @returns {WasmPreprocessingOptions}
|
|
3865
|
+
*/
|
|
3866
|
+
static fromUpdate(update) {
|
|
3867
|
+
_assertClass(update, WasmPreprocessingOptionsUpdate);
|
|
3868
|
+
var ptr0 = update.__destroy_into_raw();
|
|
3869
|
+
const ret = wasm.wasmpreprocessingoptions_fromUpdate(ptr0);
|
|
3870
|
+
return WasmPreprocessingOptions.__wrap(ret);
|
|
3871
|
+
}
|
|
3423
3872
|
/**
|
|
3424
3873
|
* @param {boolean | null} [enabled]
|
|
3425
3874
|
* @param {WasmPreprocessingPreset | null} [preset]
|
|
@@ -3480,6 +3929,13 @@ export class WasmPreprocessingOptions {
|
|
|
3480
3929
|
}
|
|
3481
3930
|
if (Symbol.dispose) WasmPreprocessingOptions.prototype[Symbol.dispose] = WasmPreprocessingOptions.prototype.free;
|
|
3482
3931
|
|
|
3932
|
+
/**
|
|
3933
|
+
* Partial update for `PreprocessingOptions`.
|
|
3934
|
+
*
|
|
3935
|
+
* This struct uses `Option<T>` to represent optional fields that can be selectively updated.
|
|
3936
|
+
* Only specified fields (Some values) will override existing options; None values leave the
|
|
3937
|
+
* corresponding fields unchanged when applied via [`PreprocessingOptions::apply_update`].
|
|
3938
|
+
*/
|
|
3483
3939
|
export class WasmPreprocessingOptionsUpdate {
|
|
3484
3940
|
static __wrap(ptr) {
|
|
3485
3941
|
ptr = ptr >>> 0;
|
|
@@ -3566,6 +4022,9 @@ export class WasmPreprocessingOptionsUpdate {
|
|
|
3566
4022
|
if (Symbol.dispose) WasmPreprocessingOptionsUpdate.prototype[Symbol.dispose] = WasmPreprocessingOptionsUpdate.prototype.free;
|
|
3567
4023
|
|
|
3568
4024
|
/**
|
|
4025
|
+
* HTML preprocessing aggressiveness level.
|
|
4026
|
+
*
|
|
4027
|
+
* Controls the extent of cleanup performed before conversion. Higher levels remove more elements.
|
|
3569
4028
|
* @enum {0 | 1 | 2}
|
|
3570
4029
|
*/
|
|
3571
4030
|
export const WasmPreprocessingPreset = Object.freeze({
|
|
@@ -3574,6 +4033,9 @@ export const WasmPreprocessingPreset = Object.freeze({
|
|
|
3574
4033
|
Aggressive: 2, "2": "Aggressive",
|
|
3575
4034
|
});
|
|
3576
4035
|
|
|
4036
|
+
/**
|
|
4037
|
+
* A non-fatal warning generated during HTML processing.
|
|
4038
|
+
*/
|
|
3577
4039
|
export class WasmProcessingWarning {
|
|
3578
4040
|
static __wrap(ptr) {
|
|
3579
4041
|
ptr = ptr >>> 0;
|
|
@@ -3621,7 +4083,7 @@ export class WasmProcessingWarning {
|
|
|
3621
4083
|
return getStringFromWasm0(r0, r1);
|
|
3622
4084
|
} finally {
|
|
3623
4085
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
3624
|
-
wasm.
|
|
4086
|
+
wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
|
|
3625
4087
|
}
|
|
3626
4088
|
}
|
|
3627
4089
|
/**
|
|
@@ -3653,6 +4115,25 @@ export class WasmProcessingWarning {
|
|
|
3653
4115
|
}
|
|
3654
4116
|
if (Symbol.dispose) WasmProcessingWarning.prototype[Symbol.dispose] = WasmProcessingWarning.prototype.free;
|
|
3655
4117
|
|
|
4118
|
+
/**
|
|
4119
|
+
* Structured data block (JSON-LD, Microdata, or RDFa).
|
|
4120
|
+
*
|
|
4121
|
+
* Represents machine-readable structured data found in the document.
|
|
4122
|
+
* JSON-LD blocks are collected as raw JSON strings for flexibility.
|
|
4123
|
+
*
|
|
4124
|
+
* # Examples
|
|
4125
|
+
*
|
|
4126
|
+
* ```
|
|
4127
|
+
* # use html_to_markdown_rs::metadata::{StructuredData, StructuredDataType};
|
|
4128
|
+
* let schema = StructuredData {
|
|
4129
|
+
* data_type: StructuredDataType::JsonLd,
|
|
4130
|
+
* raw_json: r#"{"@context":"https://schema.org","@type":"Article"}"#.to_string(),
|
|
4131
|
+
* schema_type: Some("Article".to_string()),
|
|
4132
|
+
* };
|
|
4133
|
+
*
|
|
4134
|
+
* assert_eq!(schema.data_type, StructuredDataType::JsonLd);
|
|
4135
|
+
* ```
|
|
4136
|
+
*/
|
|
3656
4137
|
export class WasmStructuredData {
|
|
3657
4138
|
static __wrap(ptr) {
|
|
3658
4139
|
ptr = ptr >>> 0;
|
|
@@ -3715,7 +4196,7 @@ export class WasmStructuredData {
|
|
|
3715
4196
|
return getStringFromWasm0(r0, r1);
|
|
3716
4197
|
} finally {
|
|
3717
4198
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
3718
|
-
wasm.
|
|
4199
|
+
wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
|
|
3719
4200
|
}
|
|
3720
4201
|
}
|
|
3721
4202
|
/**
|
|
@@ -3730,7 +4211,7 @@ export class WasmStructuredData {
|
|
|
3730
4211
|
let v1;
|
|
3731
4212
|
if (r0 !== 0) {
|
|
3732
4213
|
v1 = getStringFromWasm0(r0, r1).slice();
|
|
3733
|
-
wasm.
|
|
4214
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
3734
4215
|
}
|
|
3735
4216
|
return v1;
|
|
3736
4217
|
} finally {
|
|
@@ -3763,6 +4244,9 @@ export class WasmStructuredData {
|
|
|
3763
4244
|
if (Symbol.dispose) WasmStructuredData.prototype[Symbol.dispose] = WasmStructuredData.prototype.free;
|
|
3764
4245
|
|
|
3765
4246
|
/**
|
|
4247
|
+
* Structured data format type.
|
|
4248
|
+
*
|
|
4249
|
+
* Identifies the schema/format used for structured data markup.
|
|
3766
4250
|
* @enum {0 | 1 | 2}
|
|
3767
4251
|
*/
|
|
3768
4252
|
export const WasmStructuredDataType = Object.freeze({
|
|
@@ -3771,6 +4255,9 @@ export const WasmStructuredDataType = Object.freeze({
|
|
|
3771
4255
|
RDFa: 2, "2": "RDFa",
|
|
3772
4256
|
});
|
|
3773
4257
|
|
|
4258
|
+
/**
|
|
4259
|
+
* A top-level extracted table with both structured data and markdown representation.
|
|
4260
|
+
*/
|
|
3774
4261
|
export class WasmTableData {
|
|
3775
4262
|
static __wrap(ptr) {
|
|
3776
4263
|
ptr = ptr >>> 0;
|
|
@@ -3818,7 +4305,7 @@ export class WasmTableData {
|
|
|
3818
4305
|
return getStringFromWasm0(r0, r1);
|
|
3819
4306
|
} finally {
|
|
3820
4307
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
3821
|
-
wasm.
|
|
4308
|
+
wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
|
|
3822
4309
|
}
|
|
3823
4310
|
}
|
|
3824
4311
|
/**
|
|
@@ -3854,6 +4341,9 @@ export class WasmTableData {
|
|
|
3854
4341
|
}
|
|
3855
4342
|
if (Symbol.dispose) WasmTableData.prototype[Symbol.dispose] = WasmTableData.prototype.free;
|
|
3856
4343
|
|
|
4344
|
+
/**
|
|
4345
|
+
* A structured table grid with cell-level data including spans.
|
|
4346
|
+
*/
|
|
3857
4347
|
export class WasmTableGrid {
|
|
3858
4348
|
static __wrap(ptr) {
|
|
3859
4349
|
ptr = ptr >>> 0;
|
|
@@ -3882,7 +4372,7 @@ export class WasmTableGrid {
|
|
|
3882
4372
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
3883
4373
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
3884
4374
|
var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
|
|
3885
|
-
wasm.
|
|
4375
|
+
wasm.__wbindgen_export4(r0, r1 * 4, 4);
|
|
3886
4376
|
return v1;
|
|
3887
4377
|
} finally {
|
|
3888
4378
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
@@ -3938,6 +4428,11 @@ export class WasmTableGrid {
|
|
|
3938
4428
|
}
|
|
3939
4429
|
if (Symbol.dispose) WasmTableGrid.prototype[Symbol.dispose] = WasmTableGrid.prototype.free;
|
|
3940
4430
|
|
|
4431
|
+
/**
|
|
4432
|
+
* An inline text annotation with byte-range offsets.
|
|
4433
|
+
*
|
|
4434
|
+
* Annotations describe formatting (bold, italic, etc.) and links within a node's text content.
|
|
4435
|
+
*/
|
|
3941
4436
|
export class WasmTextAnnotation {
|
|
3942
4437
|
static __wrap(ptr) {
|
|
3943
4438
|
ptr = ptr >>> 0;
|
|
@@ -4016,6 +4511,9 @@ export class WasmTextAnnotation {
|
|
|
4016
4511
|
if (Symbol.dispose) WasmTextAnnotation.prototype[Symbol.dispose] = WasmTextAnnotation.prototype.free;
|
|
4017
4512
|
|
|
4018
4513
|
/**
|
|
4514
|
+
* Text directionality of document content.
|
|
4515
|
+
*
|
|
4516
|
+
* Corresponds to the HTML `dir` attribute and `bdi` element directionality.
|
|
4019
4517
|
* @enum {0 | 1 | 2}
|
|
4020
4518
|
*/
|
|
4021
4519
|
export const WasmTextDirection = Object.freeze({
|
|
@@ -4025,17 +4523,38 @@ export const WasmTextDirection = Object.freeze({
|
|
|
4025
4523
|
});
|
|
4026
4524
|
|
|
4027
4525
|
/**
|
|
4526
|
+
* Result of a visitor callback.
|
|
4527
|
+
*
|
|
4528
|
+
* Allows visitors to control the conversion flow by either proceeding
|
|
4529
|
+
* with default behavior, providing custom output, skipping elements,
|
|
4530
|
+
* preserving HTML, or signaling errors.
|
|
4028
4531
|
* @enum {0 | 1 | 2 | 3 | 4}
|
|
4029
4532
|
*/
|
|
4533
|
+
export const WasmVisitResult = Object.freeze({
|
|
4534
|
+
Continue: 0, "0": "Continue",
|
|
4535
|
+
Custom: 1, "1": "Custom",
|
|
4536
|
+
Skip: 2, "2": "Skip",
|
|
4537
|
+
PreserveHtml: 3, "3": "PreserveHtml",
|
|
4538
|
+
Error: 4, "4": "Error",
|
|
4539
|
+
});
|
|
4540
|
+
|
|
4541
|
+
/**
|
|
4542
|
+
* Categories of processing warnings.
|
|
4543
|
+
* @enum {0 | 1 | 2 | 3 | 4 | 5}
|
|
4544
|
+
*/
|
|
4030
4545
|
export const WasmWarningKind = Object.freeze({
|
|
4031
4546
|
ImageExtractionFailed: 0, "0": "ImageExtractionFailed",
|
|
4032
4547
|
EncodingFallback: 1, "1": "EncodingFallback",
|
|
4033
4548
|
TruncatedInput: 2, "2": "TruncatedInput",
|
|
4034
4549
|
MalformedHtml: 3, "3": "MalformedHtml",
|
|
4035
4550
|
SanitizationApplied: 4, "4": "SanitizationApplied",
|
|
4551
|
+
DepthLimitExceeded: 5, "5": "DepthLimitExceeded",
|
|
4036
4552
|
});
|
|
4037
4553
|
|
|
4038
4554
|
/**
|
|
4555
|
+
* Whitespace handling strategy during conversion.
|
|
4556
|
+
*
|
|
4557
|
+
* Determines how sequences of whitespace characters (spaces, tabs, newlines) are processed.
|
|
4039
4558
|
* @enum {0 | 1}
|
|
4040
4559
|
*/
|
|
4041
4560
|
export const WasmWhitespaceMode = Object.freeze({
|
|
@@ -4046,9 +4565,10 @@ export const WasmWhitespaceMode = Object.freeze({
|
|
|
4046
4565
|
/**
|
|
4047
4566
|
* @param {string} html
|
|
4048
4567
|
* @param {WasmConversionOptions | null} [options]
|
|
4568
|
+
* @param {any | null} [visitor]
|
|
4049
4569
|
* @returns {WasmConversionResult}
|
|
4050
4570
|
*/
|
|
4051
|
-
export function convert(html, options) {
|
|
4571
|
+
export function convert(html, options, visitor) {
|
|
4052
4572
|
try {
|
|
4053
4573
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
4054
4574
|
const ptr0 = passStringToWasm0(html, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
@@ -4058,7 +4578,7 @@ export function convert(html, options) {
|
|
|
4058
4578
|
_assertClass(options, WasmConversionOptions);
|
|
4059
4579
|
ptr1 = options.__destroy_into_raw();
|
|
4060
4580
|
}
|
|
4061
|
-
wasm.convert(retptr, ptr0, len0, ptr1);
|
|
4581
|
+
wasm.convert(retptr, ptr0, len0, ptr1, isLikeNone(visitor) ? 0 : addHeapObject(visitor));
|
|
4062
4582
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
4063
4583
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
4064
4584
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -4077,6 +4597,10 @@ function __wbg_get_imports() {
|
|
|
4077
4597
|
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
4078
4598
|
return addHeapObject(ret);
|
|
4079
4599
|
},
|
|
4600
|
+
__wbg___wbindgen_is_function_3baa9db1a987f47d: function(arg0) {
|
|
4601
|
+
const ret = typeof(getObject(arg0)) === 'function';
|
|
4602
|
+
return ret;
|
|
4603
|
+
},
|
|
4080
4604
|
__wbg___wbindgen_is_string_6df3bf7ef1164ed3: function(arg0) {
|
|
4081
4605
|
const ret = typeof(getObject(arg0)) === 'string';
|
|
4082
4606
|
return ret;
|
|
@@ -4096,14 +4620,38 @@ function __wbg_get_imports() {
|
|
|
4096
4620
|
__wbg___wbindgen_throw_6b64449b9b9ed33c: function(arg0, arg1) {
|
|
4097
4621
|
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
4098
4622
|
},
|
|
4623
|
+
__wbg_apply_4c35bd236dda9c14: function() { return handleError(function (arg0, arg1, arg2) {
|
|
4624
|
+
const ret = getObject(arg0).apply(getObject(arg1), getObject(arg2));
|
|
4625
|
+
return addHeapObject(ret);
|
|
4626
|
+
}, arguments); },
|
|
4627
|
+
__wbg_get_6011fa3a58f61074: function() { return handleError(function (arg0, arg1) {
|
|
4628
|
+
const ret = Reflect.get(getObject(arg0), getObject(arg1));
|
|
4629
|
+
return addHeapObject(ret);
|
|
4630
|
+
}, arguments); },
|
|
4631
|
+
__wbg_has_880f1d472f7cecba: function() { return handleError(function (arg0, arg1) {
|
|
4632
|
+
const ret = Reflect.has(getObject(arg0), getObject(arg1));
|
|
4633
|
+
return ret;
|
|
4634
|
+
}, arguments); },
|
|
4099
4635
|
__wbg_new_34d45cc8e36aaead: function() {
|
|
4100
4636
|
const ret = new Map();
|
|
4101
4637
|
return addHeapObject(ret);
|
|
4102
4638
|
},
|
|
4639
|
+
__wbg_new_682678e2f47e32bc: function() {
|
|
4640
|
+
const ret = new Array();
|
|
4641
|
+
return addHeapObject(ret);
|
|
4642
|
+
},
|
|
4103
4643
|
__wbg_new_aa8d0fa9762c29bd: function() {
|
|
4104
4644
|
const ret = new Object();
|
|
4105
4645
|
return addHeapObject(ret);
|
|
4106
4646
|
},
|
|
4647
|
+
__wbg_push_471a5b068a5295f6: function(arg0, arg1) {
|
|
4648
|
+
const ret = getObject(arg0).push(getObject(arg1));
|
|
4649
|
+
return ret;
|
|
4650
|
+
},
|
|
4651
|
+
__wbg_set_022bee52d0b05b19: function() { return handleError(function (arg0, arg1, arg2) {
|
|
4652
|
+
const ret = Reflect.set(getObject(arg0), getObject(arg1), getObject(arg2));
|
|
4653
|
+
return ret;
|
|
4654
|
+
}, arguments); },
|
|
4107
4655
|
__wbg_set_6be42768c690e380: function(arg0, arg1, arg2) {
|
|
4108
4656
|
getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
|
|
4109
4657
|
},
|
|
@@ -4183,7 +4731,12 @@ function __wbg_get_imports() {
|
|
|
4183
4731
|
const ret = WasmTextAnnotation.__unwrap(getObject(arg0));
|
|
4184
4732
|
return ret;
|
|
4185
4733
|
},
|
|
4186
|
-
__wbindgen_cast_0000000000000001: function(arg0
|
|
4734
|
+
__wbindgen_cast_0000000000000001: function(arg0) {
|
|
4735
|
+
// Cast intrinsic for `F64 -> Externref`.
|
|
4736
|
+
const ret = arg0;
|
|
4737
|
+
return addHeapObject(ret);
|
|
4738
|
+
},
|
|
4739
|
+
__wbindgen_cast_0000000000000002: function(arg0, arg1) {
|
|
4187
4740
|
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
4188
4741
|
const ret = getStringFromWasm0(arg0, arg1);
|
|
4189
4742
|
return addHeapObject(ret);
|
|
@@ -4238,12 +4791,9 @@ const WasmImageMetadataFinalization = (typeof FinalizationRegistry === 'undefine
|
|
|
4238
4791
|
const WasmLinkMetadataFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
4239
4792
|
? { register: () => {}, unregister: () => {} }
|
|
4240
4793
|
: new FinalizationRegistry(ptr => wasm.__wbg_wasmlinkmetadata_free(ptr >>> 0, 1));
|
|
4241
|
-
const
|
|
4794
|
+
const WasmNodeContextFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
4242
4795
|
? { register: () => {}, unregister: () => {} }
|
|
4243
|
-
: new FinalizationRegistry(ptr => wasm.
|
|
4244
|
-
const WasmMetadataConfigUpdateFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
4245
|
-
? { register: () => {}, unregister: () => {} }
|
|
4246
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_wasmmetadataconfigupdate_free(ptr >>> 0, 1));
|
|
4796
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_wasmnodecontext_free(ptr >>> 0, 1));
|
|
4247
4797
|
const WasmPreprocessingOptionsFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
4248
4798
|
? { register: () => {}, unregister: () => {} }
|
|
4249
4799
|
: new FinalizationRegistry(ptr => wasm.__wbg_wasmpreprocessingoptions_free(ptr >>> 0, 1));
|
|
@@ -4333,6 +4883,14 @@ function getUint8ArrayMemory0() {
|
|
|
4333
4883
|
|
|
4334
4884
|
function getObject(idx) { return heap[idx]; }
|
|
4335
4885
|
|
|
4886
|
+
function handleError(f, args) {
|
|
4887
|
+
try {
|
|
4888
|
+
return f.apply(this, args);
|
|
4889
|
+
} catch (e) {
|
|
4890
|
+
wasm.__wbindgen_export3(addHeapObject(e));
|
|
4891
|
+
}
|
|
4892
|
+
}
|
|
4893
|
+
|
|
4336
4894
|
let heap = new Array(1024).fill(undefined);
|
|
4337
4895
|
heap.push(undefined, null, true, false);
|
|
4338
4896
|
|