@kreuzberg/html-to-markdown-wasm 3.4.0-rc.8 → 3.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +33 -63
- package/{dist-node → pkg/bundler}/html_to_markdown_wasm.d.ts +45 -136
- package/pkg/bundler/html_to_markdown_wasm.js +9 -0
- package/{dist → pkg/bundler}/html_to_markdown_wasm_bg.js +149 -52
- package/{dist-web → pkg/bundler}/html_to_markdown_wasm_bg.wasm +0 -0
- package/{dist-web → pkg/bundler}/html_to_markdown_wasm_bg.wasm.d.ts +10 -3
- package/{dist → pkg/bundler}/package.json +6 -5
- package/{dist → pkg/deno}/html_to_markdown_wasm.d.ts +45 -139
- package/pkg/deno/html_to_markdown_wasm.js +5054 -0
- package/{dist → pkg/deno}/html_to_markdown_wasm_bg.wasm +0 -0
- package/{dist → pkg/deno}/html_to_markdown_wasm_bg.wasm.d.ts +10 -3
- package/pkg/nodejs/html_to_markdown_wasm.d.ts +1020 -0
- package/{dist-node → pkg/nodejs}/html_to_markdown_wasm.js +150 -52
- package/{dist-node → pkg/nodejs}/html_to_markdown_wasm_bg.wasm +0 -0
- package/{dist-node → pkg/nodejs}/html_to_markdown_wasm_bg.wasm.d.ts +10 -3
- package/{dist-node → pkg/nodejs}/package.json +5 -5
- package/{dist-web → pkg/web}/html_to_markdown_wasm.d.ts +55 -139
- package/{dist-web → pkg/web}/html_to_markdown_wasm.js +149 -52
- package/pkg/web/html_to_markdown_wasm_bg.wasm +0 -0
- package/pkg/web/html_to_markdown_wasm_bg.wasm.d.ts +394 -0
- package/{dist-web → pkg/web}/package.json +5 -5
- package/dist/html_to_markdown_wasm.js +0 -116
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* @typedef {import("./html_to_markdown_wasm").WasmConversionOptions} WasmConversionOptions
|
|
4
|
-
*/
|
|
5
1
|
/* @ts-self-types="./html_to_markdown_wasm.d.ts" */
|
|
6
2
|
|
|
7
3
|
/**
|
|
@@ -397,8 +393,9 @@ export class WasmConversionOptions {
|
|
|
397
393
|
* @param {boolean | null} [infer_dimensions]
|
|
398
394
|
* @param {string[] | null} [exclude_selectors]
|
|
399
395
|
* @param {number | null} [max_depth]
|
|
396
|
+
* @param {WasmVisitorHandle | null} [visitor]
|
|
400
397
|
*/
|
|
401
|
-
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) {
|
|
398
|
+
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, visitor) {
|
|
402
399
|
var ptr0 = isLikeNone(bullets) ? 0 : passStringToWasm0(bullets, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
403
400
|
var len0 = WASM_VECTOR_LEN;
|
|
404
401
|
var ptr1 = isLikeNone(strong_em_symbol) ? 0 : passStringToWasm0(strong_em_symbol, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
@@ -424,7 +421,12 @@ export class WasmConversionOptions {
|
|
|
424
421
|
var len9 = WASM_VECTOR_LEN;
|
|
425
422
|
var ptr10 = isLikeNone(exclude_selectors) ? 0 : passArrayJsValueToWasm0(exclude_selectors, wasm.__wbindgen_export);
|
|
426
423
|
var len10 = WASM_VECTOR_LEN;
|
|
427
|
-
|
|
424
|
+
let ptr11 = 0;
|
|
425
|
+
if (!isLikeNone(visitor)) {
|
|
426
|
+
_assertClass(visitor, WasmVisitorHandle);
|
|
427
|
+
ptr11 = visitor.__destroy_into_raw();
|
|
428
|
+
}
|
|
429
|
+
const ret = wasm.wasmconversionoptions_new(isLikeNone(heading_style) ? 3 : heading_style, isLikeNone(list_indent_type) ? 2 : list_indent_type, isLikeNone(list_indent_width) ? Number.MAX_SAFE_INTEGER : (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) ? Number.MAX_SAFE_INTEGER : (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) ? Number.MAX_SAFE_INTEGER : (max_depth) >>> 0, ptr11);
|
|
428
430
|
this.__wbg_ptr = ret;
|
|
429
431
|
WasmConversionOptionsFinalization.register(this, this.__wbg_ptr, this);
|
|
430
432
|
return this;
|
|
@@ -710,6 +712,17 @@ export class WasmConversionOptions {
|
|
|
710
712
|
const len0 = WASM_VECTOR_LEN;
|
|
711
713
|
wasm.wasmconversionoptions_set_supSymbol(this.__wbg_ptr, ptr0, len0);
|
|
712
714
|
}
|
|
715
|
+
/**
|
|
716
|
+
* @param {WasmVisitorHandle | null} [value]
|
|
717
|
+
*/
|
|
718
|
+
set visitor(value) {
|
|
719
|
+
let ptr0 = 0;
|
|
720
|
+
if (!isLikeNone(value)) {
|
|
721
|
+
_assertClass(value, WasmVisitorHandle);
|
|
722
|
+
ptr0 = value.__destroy_into_raw();
|
|
723
|
+
}
|
|
724
|
+
wasm.wasmconversionoptions_set_visitor(this.__wbg_ptr, ptr0);
|
|
725
|
+
}
|
|
713
726
|
/**
|
|
714
727
|
* @param {WasmWhitespaceMode} value
|
|
715
728
|
*/
|
|
@@ -815,6 +828,13 @@ export class WasmConversionOptions {
|
|
|
815
828
|
wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
|
|
816
829
|
}
|
|
817
830
|
}
|
|
831
|
+
/**
|
|
832
|
+
* @returns {WasmVisitorHandle | undefined}
|
|
833
|
+
*/
|
|
834
|
+
get visitor() {
|
|
835
|
+
const ret = wasm.wasmconversionoptions_visitor(this.__wbg_ptr);
|
|
836
|
+
return ret === 0 ? undefined : WasmVisitorHandle.__wrap(ret);
|
|
837
|
+
}
|
|
818
838
|
/**
|
|
819
839
|
* @returns {WasmWhitespaceMode}
|
|
820
840
|
*/
|
|
@@ -924,6 +944,20 @@ export class WasmConversionOptionsBuilder {
|
|
|
924
944
|
const ret = wasm.wasmconversionoptionsbuilder_stripTags(this.__wbg_ptr, ptr0, len0);
|
|
925
945
|
return WasmConversionOptionsBuilder.__wrap(ret);
|
|
926
946
|
}
|
|
947
|
+
/**
|
|
948
|
+
* Set the visitor used during conversion.
|
|
949
|
+
* @param {WasmVisitorHandle | null} [visitor]
|
|
950
|
+
* @returns {WasmConversionOptionsBuilder}
|
|
951
|
+
*/
|
|
952
|
+
visitor(visitor) {
|
|
953
|
+
let ptr0 = 0;
|
|
954
|
+
if (!isLikeNone(visitor)) {
|
|
955
|
+
_assertClass(visitor, WasmVisitorHandle);
|
|
956
|
+
ptr0 = visitor.__destroy_into_raw();
|
|
957
|
+
}
|
|
958
|
+
const ret = wasm.wasmconversionoptionsbuilder_visitor(this.__wbg_ptr, ptr0);
|
|
959
|
+
return WasmConversionOptionsBuilder.__wrap(ret);
|
|
960
|
+
}
|
|
927
961
|
}
|
|
928
962
|
if (Symbol.dispose) WasmConversionOptionsBuilder.prototype[Symbol.dispose] = WasmConversionOptionsBuilder.prototype.free;
|
|
929
963
|
|
|
@@ -1241,8 +1275,9 @@ export class WasmConversionOptionsUpdate {
|
|
|
1241
1275
|
* @param {boolean | null} [infer_dimensions]
|
|
1242
1276
|
* @param {number | null} [max_depth]
|
|
1243
1277
|
* @param {string[] | null} [exclude_selectors]
|
|
1278
|
+
* @param {WasmVisitorHandle | null} [visitor]
|
|
1244
1279
|
*/
|
|
1245
|
-
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) {
|
|
1280
|
+
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, visitor) {
|
|
1246
1281
|
var ptr0 = isLikeNone(bullets) ? 0 : passStringToWasm0(bullets, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
1247
1282
|
var len0 = WASM_VECTOR_LEN;
|
|
1248
1283
|
var ptr1 = isLikeNone(strong_em_symbol) ? 0 : passStringToWasm0(strong_em_symbol, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
@@ -1268,7 +1303,12 @@ export class WasmConversionOptionsUpdate {
|
|
|
1268
1303
|
var len9 = WASM_VECTOR_LEN;
|
|
1269
1304
|
var ptr10 = isLikeNone(exclude_selectors) ? 0 : passArrayJsValueToWasm0(exclude_selectors, wasm.__wbindgen_export);
|
|
1270
1305
|
var len10 = WASM_VECTOR_LEN;
|
|
1271
|
-
|
|
1306
|
+
let ptr11 = 0;
|
|
1307
|
+
if (!isLikeNone(visitor)) {
|
|
1308
|
+
_assertClass(visitor, WasmVisitorHandle);
|
|
1309
|
+
ptr11 = visitor.__destroy_into_raw();
|
|
1310
|
+
}
|
|
1311
|
+
const ret = wasm.wasmconversionoptionsupdate_new(isLikeNone(heading_style) ? 3 : heading_style, isLikeNone(list_indent_type) ? 2 : list_indent_type, isLikeNone(list_indent_width) ? Number.MAX_SAFE_INTEGER : (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) ? Number.MAX_SAFE_INTEGER : (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) ? Number.MAX_SAFE_INTEGER : (max_depth) >>> 0, ptr10, len10, ptr11);
|
|
1272
1312
|
this.__wbg_ptr = ret;
|
|
1273
1313
|
WasmConversionOptionsUpdateFinalization.register(this, this.__wbg_ptr, this);
|
|
1274
1314
|
return this;
|
|
@@ -1560,6 +1600,17 @@ export class WasmConversionOptionsUpdate {
|
|
|
1560
1600
|
var len0 = WASM_VECTOR_LEN;
|
|
1561
1601
|
wasm.wasmconversionoptionsupdate_set_supSymbol(this.__wbg_ptr, ptr0, len0);
|
|
1562
1602
|
}
|
|
1603
|
+
/**
|
|
1604
|
+
* @param {WasmVisitorHandle | null} [value]
|
|
1605
|
+
*/
|
|
1606
|
+
set visitor(value) {
|
|
1607
|
+
let ptr0 = 0;
|
|
1608
|
+
if (!isLikeNone(value)) {
|
|
1609
|
+
_assertClass(value, WasmVisitorHandle);
|
|
1610
|
+
ptr0 = value.__destroy_into_raw();
|
|
1611
|
+
}
|
|
1612
|
+
wasm.wasmconversionoptionsupdate_set_visitor(this.__wbg_ptr, ptr0);
|
|
1613
|
+
}
|
|
1563
1614
|
/**
|
|
1564
1615
|
* @param {WasmWhitespaceMode | null} [value]
|
|
1565
1616
|
*/
|
|
@@ -1668,6 +1719,13 @@ export class WasmConversionOptionsUpdate {
|
|
|
1668
1719
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1669
1720
|
}
|
|
1670
1721
|
}
|
|
1722
|
+
/**
|
|
1723
|
+
* @returns {WasmVisitorHandle | undefined}
|
|
1724
|
+
*/
|
|
1725
|
+
get visitor() {
|
|
1726
|
+
const ret = wasm.wasmconversionoptionsupdate_visitor(this.__wbg_ptr);
|
|
1727
|
+
return ret === 0 ? undefined : WasmVisitorHandle.__wrap(ret);
|
|
1728
|
+
}
|
|
1671
1729
|
/**
|
|
1672
1730
|
* @returns {WasmWhitespaceMode | undefined}
|
|
1673
1731
|
*/
|
|
@@ -1901,7 +1959,6 @@ if (Symbol.dispose) WasmConversionResult.prototype[Symbol.dispose] = WasmConvers
|
|
|
1901
1959
|
* # Examples
|
|
1902
1960
|
*
|
|
1903
1961
|
* ```
|
|
1904
|
-
* # use html_to_markdown_rs::metadata::DocumentMetadata;
|
|
1905
1962
|
* let doc = DocumentMetadata {
|
|
1906
1963
|
* title: Some("My Article".to_string()),
|
|
1907
1964
|
* description: Some("A great article about Rust".to_string()),
|
|
@@ -2041,7 +2098,7 @@ export class WasmDocumentMetadata {
|
|
|
2041
2098
|
}
|
|
2042
2099
|
}
|
|
2043
2100
|
/**
|
|
2044
|
-
* @returns {
|
|
2101
|
+
* @returns {any}
|
|
2045
2102
|
*/
|
|
2046
2103
|
get metaTags() {
|
|
2047
2104
|
const ret = wasm.wasmdocumentmetadata_metaTags(this.__wbg_ptr);
|
|
@@ -2081,7 +2138,7 @@ export class WasmDocumentMetadata {
|
|
|
2081
2138
|
return this;
|
|
2082
2139
|
}
|
|
2083
2140
|
/**
|
|
2084
|
-
* @returns {
|
|
2141
|
+
* @returns {any}
|
|
2085
2142
|
*/
|
|
2086
2143
|
get openGraph() {
|
|
2087
2144
|
const ret = wasm.wasmdocumentmetadata_openGraph(this.__wbg_ptr);
|
|
@@ -2194,7 +2251,7 @@ export class WasmDocumentMetadata {
|
|
|
2194
2251
|
}
|
|
2195
2252
|
}
|
|
2196
2253
|
/**
|
|
2197
|
-
* @returns {
|
|
2254
|
+
* @returns {any}
|
|
2198
2255
|
*/
|
|
2199
2256
|
get twitterCard() {
|
|
2200
2257
|
const ret = wasm.wasmdocumentmetadata_twitterCard(this.__wbg_ptr);
|
|
@@ -2602,7 +2659,6 @@ if (Symbol.dispose) WasmGridCell.prototype[Symbol.dispose] = WasmGridCell.protot
|
|
|
2602
2659
|
* # Examples
|
|
2603
2660
|
*
|
|
2604
2661
|
* ```
|
|
2605
|
-
* # use html_to_markdown_rs::metadata::HeaderMetadata;
|
|
2606
2662
|
* let header = HeaderMetadata {
|
|
2607
2663
|
* level: 1,
|
|
2608
2664
|
* text: "Main Title".to_string(),
|
|
@@ -2681,7 +2737,6 @@ export class WasmHeaderMetadata {
|
|
|
2681
2737
|
* # Examples
|
|
2682
2738
|
*
|
|
2683
2739
|
* ```
|
|
2684
|
-
* # use html_to_markdown_rs::metadata::HeaderMetadata;
|
|
2685
2740
|
* let valid = HeaderMetadata {
|
|
2686
2741
|
* level: 3,
|
|
2687
2742
|
* text: "Title".to_string(),
|
|
@@ -2820,7 +2875,6 @@ export const WasmHighlightStyle = Object.freeze({
|
|
|
2820
2875
|
* # Examples
|
|
2821
2876
|
*
|
|
2822
2877
|
* ```
|
|
2823
|
-
* # use html_to_markdown_rs::metadata::HtmlMetadata;
|
|
2824
2878
|
* let metadata = HtmlMetadata {
|
|
2825
2879
|
* document: Default::default(),
|
|
2826
2880
|
* headers: Vec::new(),
|
|
@@ -2998,7 +3052,6 @@ if (Symbol.dispose) WasmHtmlMetadata.prototype[Symbol.dispose] = WasmHtmlMetadat
|
|
|
2998
3052
|
* # Examples
|
|
2999
3053
|
*
|
|
3000
3054
|
* ```
|
|
3001
|
-
* # use html_to_markdown_rs::metadata::{ImageMetadata, ImageType};
|
|
3002
3055
|
* let img = ImageMetadata {
|
|
3003
3056
|
* src: "https://example.com/image.jpg".to_string(),
|
|
3004
3057
|
* alt: Some("An example image".to_string()),
|
|
@@ -3054,7 +3107,7 @@ export class WasmImageMetadata {
|
|
|
3054
3107
|
}
|
|
3055
3108
|
}
|
|
3056
3109
|
/**
|
|
3057
|
-
* @returns {
|
|
3110
|
+
* @returns {any}
|
|
3058
3111
|
*/
|
|
3059
3112
|
get attributes() {
|
|
3060
3113
|
const ret = wasm.wasmimagemetadata_attributes(this.__wbg_ptr);
|
|
@@ -3214,7 +3267,6 @@ export const WasmImageType = Object.freeze({
|
|
|
3214
3267
|
* # Examples
|
|
3215
3268
|
*
|
|
3216
3269
|
* ```
|
|
3217
|
-
* # use html_to_markdown_rs::metadata::{LinkMetadata, LinkType};
|
|
3218
3270
|
* let link = LinkMetadata {
|
|
3219
3271
|
* href: "https://example.com".to_string(),
|
|
3220
3272
|
* text: "Example".to_string(),
|
|
@@ -3252,7 +3304,7 @@ export class WasmLinkMetadata {
|
|
|
3252
3304
|
wasm.__wbg_wasmlinkmetadata_free(ptr, 0);
|
|
3253
3305
|
}
|
|
3254
3306
|
/**
|
|
3255
|
-
* @returns {
|
|
3307
|
+
* @returns {any}
|
|
3256
3308
|
*/
|
|
3257
3309
|
get attributes() {
|
|
3258
3310
|
const ret = wasm.wasmlinkmetadata_attributes(this.__wbg_ptr);
|
|
@@ -3272,7 +3324,6 @@ export class WasmLinkMetadata {
|
|
|
3272
3324
|
* # Examples
|
|
3273
3325
|
*
|
|
3274
3326
|
* ```
|
|
3275
|
-
* # use html_to_markdown_rs::metadata::{LinkMetadata, LinkType};
|
|
3276
3327
|
* assert_eq!(LinkMetadata::classify_link("#section"), LinkType::Anchor);
|
|
3277
3328
|
* assert_eq!(LinkMetadata::classify_link("mailto:test@example.com"), LinkType::Email);
|
|
3278
3329
|
* assert_eq!(LinkMetadata::classify_link("tel:+1234567890"), LinkType::Phone);
|
|
@@ -3525,7 +3576,7 @@ export class WasmNodeContext {
|
|
|
3525
3576
|
wasm.__wbg_wasmnodecontext_free(ptr, 0);
|
|
3526
3577
|
}
|
|
3527
3578
|
/**
|
|
3528
|
-
* @returns {
|
|
3579
|
+
* @returns {any}
|
|
3529
3580
|
*/
|
|
3530
3581
|
get attributes() {
|
|
3531
3582
|
const ret = wasm.wasmnodecontext_attributes(this.__wbg_ptr);
|
|
@@ -4110,7 +4161,6 @@ if (Symbol.dispose) WasmProcessingWarning.prototype[Symbol.dispose] = WasmProces
|
|
|
4110
4161
|
* # Examples
|
|
4111
4162
|
*
|
|
4112
4163
|
* ```
|
|
4113
|
-
* # use html_to_markdown_rs::metadata::{StructuredData, StructuredDataType};
|
|
4114
4164
|
* let schema = StructuredData {
|
|
4115
4165
|
* data_type: StructuredDataType::JsonLd,
|
|
4116
4166
|
* raw_json: r#"{"@context":"https://schema.org","@type":"Article"}"#.to_string(),
|
|
@@ -4520,6 +4570,40 @@ export const WasmVisitResult = Object.freeze({
|
|
|
4520
4570
|
Error: 4, "4": "Error",
|
|
4521
4571
|
});
|
|
4522
4572
|
|
|
4573
|
+
/**
|
|
4574
|
+
* Type alias for a visitor handle (Rc-wrapped `RefCell` for interior mutability).
|
|
4575
|
+
*
|
|
4576
|
+
* This allows visitors to be passed around and shared while still being mutable.
|
|
4577
|
+
*/
|
|
4578
|
+
export class WasmVisitorHandle {
|
|
4579
|
+
static __wrap(ptr) {
|
|
4580
|
+
const obj = Object.create(WasmVisitorHandle.prototype);
|
|
4581
|
+
obj.__wbg_ptr = ptr;
|
|
4582
|
+
WasmVisitorHandleFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
4583
|
+
return obj;
|
|
4584
|
+
}
|
|
4585
|
+
__destroy_into_raw() {
|
|
4586
|
+
const ptr = this.__wbg_ptr;
|
|
4587
|
+
this.__wbg_ptr = 0;
|
|
4588
|
+
WasmVisitorHandleFinalization.unregister(this);
|
|
4589
|
+
return ptr;
|
|
4590
|
+
}
|
|
4591
|
+
free() {
|
|
4592
|
+
const ptr = this.__destroy_into_raw();
|
|
4593
|
+
wasm.__wbg_wasmvisitorhandle_free(ptr, 0);
|
|
4594
|
+
}
|
|
4595
|
+
/**
|
|
4596
|
+
* @param {any} visitor
|
|
4597
|
+
*/
|
|
4598
|
+
constructor(visitor) {
|
|
4599
|
+
const ret = wasm.wasmvisitorhandle_new(addHeapObject(visitor));
|
|
4600
|
+
this.__wbg_ptr = ret;
|
|
4601
|
+
WasmVisitorHandleFinalization.register(this, this.__wbg_ptr, this);
|
|
4602
|
+
return this;
|
|
4603
|
+
}
|
|
4604
|
+
}
|
|
4605
|
+
if (Symbol.dispose) WasmVisitorHandle.prototype[Symbol.dispose] = WasmVisitorHandle.prototype.free;
|
|
4606
|
+
|
|
4523
4607
|
/**
|
|
4524
4608
|
* Categories of processing warnings.
|
|
4525
4609
|
* @enum {0 | 1 | 2 | 3 | 4 | 5}
|
|
@@ -4545,12 +4629,32 @@ export const WasmWhitespaceMode = Object.freeze({
|
|
|
4545
4629
|
});
|
|
4546
4630
|
|
|
4547
4631
|
/**
|
|
4632
|
+
* Convert HTML to Markdown, returning a [`ConversionResult`] with content, metadata, images,
|
|
4633
|
+
* and warnings.
|
|
4634
|
+
*
|
|
4635
|
+
* # Arguments
|
|
4636
|
+
*
|
|
4637
|
+
* * `html` — the HTML string to convert.
|
|
4638
|
+
* * `options` — optional conversion options. Defaults to [`ConversionOptions::default`].
|
|
4639
|
+
*
|
|
4640
|
+
* # Example
|
|
4641
|
+
*
|
|
4642
|
+
* ```
|
|
4643
|
+
* use html_to_markdown_rs::convert;
|
|
4644
|
+
*
|
|
4645
|
+
* let html = "<h1>Hello World</h1>";
|
|
4646
|
+
* let result = convert(html, None).unwrap();
|
|
4647
|
+
* assert!(result.content.as_deref().unwrap_or("").contains("Hello World"));
|
|
4648
|
+
* ```
|
|
4649
|
+
*
|
|
4650
|
+
* # Errors
|
|
4651
|
+
*
|
|
4652
|
+
* Returns an error if HTML parsing fails or if the input contains invalid UTF-8.
|
|
4548
4653
|
* @param {string} html
|
|
4549
4654
|
* @param {WasmConversionOptions | null} [options]
|
|
4550
|
-
* @param {any | null} [visitor]
|
|
4551
4655
|
* @returns {WasmConversionResult}
|
|
4552
4656
|
*/
|
|
4553
|
-
export function convert(html, options
|
|
4657
|
+
export function convert(html, options) {
|
|
4554
4658
|
try {
|
|
4555
4659
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
4556
4660
|
const ptr0 = passStringToWasm0(html, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
@@ -4560,7 +4664,7 @@ export function convert(html, options, visitor) {
|
|
|
4560
4664
|
_assertClass(options, WasmConversionOptions);
|
|
4561
4665
|
ptr1 = options.__destroy_into_raw();
|
|
4562
4666
|
}
|
|
4563
|
-
wasm.convert(retptr, ptr0, len0, ptr1
|
|
4667
|
+
wasm.convert(retptr, ptr0, len0, ptr1);
|
|
4564
4668
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
4565
4669
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
4566
4670
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -4575,23 +4679,20 @@ export function convert(html, options, visitor) {
|
|
|
4575
4679
|
function __wbg_get_imports() {
|
|
4576
4680
|
const import0 = {
|
|
4577
4681
|
__proto__: null,
|
|
4578
|
-
|
|
4579
|
-
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
4580
|
-
return addHeapObject(ret);
|
|
4581
|
-
},
|
|
4582
|
-
__wbg___wbindgen_is_function_2f0fd7ceb86e64c5: function(arg0) {
|
|
4682
|
+
__wbg___wbindgen_is_function_5cd60d5cf78b4eef: function(arg0) {
|
|
4583
4683
|
const ret = typeof(getObject(arg0)) === 'function';
|
|
4584
4684
|
return ret;
|
|
4585
4685
|
},
|
|
4586
|
-
|
|
4587
|
-
const
|
|
4686
|
+
__wbg___wbindgen_is_object_b4593df85baada48: function(arg0) {
|
|
4687
|
+
const val = getObject(arg0);
|
|
4688
|
+
const ret = typeof(val) === 'object' && val !== null;
|
|
4588
4689
|
return ret;
|
|
4589
4690
|
},
|
|
4590
|
-
|
|
4691
|
+
__wbg___wbindgen_is_undefined_35bb9f4c7fd651d5: function(arg0) {
|
|
4591
4692
|
const ret = getObject(arg0) === undefined;
|
|
4592
4693
|
return ret;
|
|
4593
4694
|
},
|
|
4594
|
-
|
|
4695
|
+
__wbg___wbindgen_string_get_d109740c0d18f4d7: function(arg0, arg1) {
|
|
4595
4696
|
const obj = getObject(arg1);
|
|
4596
4697
|
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
4597
4698
|
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
@@ -4599,48 +4700,41 @@ function __wbg_get_imports() {
|
|
|
4599
4700
|
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
4600
4701
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
4601
4702
|
},
|
|
4602
|
-
|
|
4703
|
+
__wbg___wbindgen_throw_9c31b086c2b26051: function(arg0, arg1) {
|
|
4603
4704
|
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
4604
4705
|
},
|
|
4605
|
-
|
|
4706
|
+
__wbg_apply_b593fcd87094fd23: function() { return handleError(function (arg0, arg1, arg2) {
|
|
4606
4707
|
const ret = getObject(arg0).apply(getObject(arg1), getObject(arg2));
|
|
4607
4708
|
return addHeapObject(ret);
|
|
4608
4709
|
}, arguments); },
|
|
4609
|
-
|
|
4710
|
+
__wbg_get_dcf82ab8aad1a593: function() { return handleError(function (arg0, arg1) {
|
|
4610
4711
|
const ret = Reflect.get(getObject(arg0), getObject(arg1));
|
|
4611
4712
|
return addHeapObject(ret);
|
|
4612
4713
|
}, arguments); },
|
|
4613
|
-
|
|
4714
|
+
__wbg_has_ef192b1f278770eb: function() { return handleError(function (arg0, arg1) {
|
|
4614
4715
|
const ret = Reflect.has(getObject(arg0), getObject(arg1));
|
|
4615
4716
|
return ret;
|
|
4616
4717
|
}, arguments); },
|
|
4617
|
-
|
|
4718
|
+
__wbg_new_02d162bc6cf02f60: function() {
|
|
4618
4719
|
const ret = new Object();
|
|
4619
4720
|
return addHeapObject(ret);
|
|
4620
4721
|
},
|
|
4621
|
-
|
|
4722
|
+
__wbg_new_310879b66b6e95e1: function() {
|
|
4622
4723
|
const ret = new Array();
|
|
4623
4724
|
return addHeapObject(ret);
|
|
4624
4725
|
},
|
|
4625
|
-
|
|
4626
|
-
const ret =
|
|
4726
|
+
__wbg_parse_2c1cad6215e84999: function() { return handleError(function (arg0, arg1) {
|
|
4727
|
+
const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
|
|
4627
4728
|
return addHeapObject(ret);
|
|
4628
|
-
},
|
|
4629
|
-
|
|
4729
|
+
}, arguments); },
|
|
4730
|
+
__wbg_push_b77c476b01548d0a: function(arg0, arg1) {
|
|
4630
4731
|
const ret = getObject(arg0).push(getObject(arg1));
|
|
4631
4732
|
return ret;
|
|
4632
4733
|
},
|
|
4633
|
-
|
|
4734
|
+
__wbg_set_a0e911be3da02782: function() { return handleError(function (arg0, arg1, arg2) {
|
|
4634
4735
|
const ret = Reflect.set(getObject(arg0), getObject(arg1), getObject(arg2));
|
|
4635
4736
|
return ret;
|
|
4636
4737
|
}, arguments); },
|
|
4637
|
-
__wbg_set_6be42768c690e380: function(arg0, arg1, arg2) {
|
|
4638
|
-
getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
|
|
4639
|
-
},
|
|
4640
|
-
__wbg_set_82f7a370f604db70: function(arg0, arg1, arg2) {
|
|
4641
|
-
const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
|
|
4642
|
-
return addHeapObject(ret);
|
|
4643
|
-
},
|
|
4644
4738
|
__wbg_wasmdocumentnode_new: function(arg0) {
|
|
4645
4739
|
const ret = WasmDocumentNode.__wrap(arg0);
|
|
4646
4740
|
return addHeapObject(ret);
|
|
@@ -4797,6 +4891,9 @@ const WasmTableGridFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
|
4797
4891
|
const WasmTextAnnotationFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
4798
4892
|
? { register: () => {}, unregister: () => {} }
|
|
4799
4893
|
: new FinalizationRegistry(ptr => wasm.__wbg_wasmtextannotation_free(ptr, 1));
|
|
4894
|
+
const WasmVisitorHandleFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
4895
|
+
? { register: () => {}, unregister: () => {} }
|
|
4896
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_wasmvisitorhandle_free(ptr, 1));
|
|
4800
4897
|
|
|
4801
4898
|
function addHeapObject(obj) {
|
|
4802
4899
|
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
Binary file
|