@kreuzberg/html-to-markdown-wasm 3.0.0 → 3.0.1
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 +76 -1
- package/dist/html_to_markdown_wasm_bg.js +58 -58
- package/dist/html_to_markdown_wasm_bg.wasm +0 -0
- package/dist/package.json +1 -1
- package/dist-node/html_to_markdown_wasm.d.ts +76 -1
- package/dist-node/html_to_markdown_wasm.js +58 -58
- package/dist-node/html_to_markdown_wasm_bg.wasm +0 -0
- package/dist-node/package.json +1 -1
- package/dist-web/html_to_markdown_wasm.d.ts +76 -1
- package/dist-web/html_to_markdown_wasm.js +58 -58
- package/dist-web/html_to_markdown_wasm_bg.wasm +0 -0
- package/dist-web/package.json +1 -1
- package/package.json +1 -1
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
* console.log(result.warnings); // []
|
|
30
30
|
* ```
|
|
31
31
|
*/
|
|
32
|
-
export function convert(html: string, options?: WasmConversionOptions | null):
|
|
32
|
+
export function convert(html: string, options?: WasmConversionOptions | null): WasmConversionResult;
|
|
33
33
|
|
|
34
34
|
/**
|
|
35
35
|
* Initialize panic hook for better error messages in the browser
|
|
@@ -47,6 +47,7 @@ export type WasmNewlineStyle = "spaces" | "backslash";
|
|
|
47
47
|
export type WasmCodeBlockStyle = "indented" | "backticks" | "tildes";
|
|
48
48
|
export type WasmHighlightStyle = "doubleEqual" | "html" | "bold" | "none";
|
|
49
49
|
export type WasmPreprocessingPreset = "minimal" | "standard" | "aggressive";
|
|
50
|
+
export type WasmOutputFormat = "markdown" | "djot" | "plain";
|
|
50
51
|
|
|
51
52
|
export interface WasmPreprocessingOptions {
|
|
52
53
|
enabled?: boolean;
|
|
@@ -87,4 +88,78 @@ export interface WasmConversionOptions {
|
|
|
87
88
|
debug?: boolean;
|
|
88
89
|
stripTags?: string[];
|
|
89
90
|
preserveTags?: string[];
|
|
91
|
+
skipImages?: boolean;
|
|
92
|
+
outputFormat?: WasmOutputFormat;
|
|
93
|
+
includeDocumentStructure?: boolean;
|
|
94
|
+
extractImages?: boolean;
|
|
95
|
+
maxImageSize?: number;
|
|
96
|
+
captureSvg?: boolean;
|
|
97
|
+
inferDimensions?: boolean;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/** A single cell in a structured table grid. */
|
|
101
|
+
export interface WasmGridCell {
|
|
102
|
+
content: string;
|
|
103
|
+
row: number;
|
|
104
|
+
col: number;
|
|
105
|
+
rowSpan: number;
|
|
106
|
+
colSpan: number;
|
|
107
|
+
isHeader: boolean;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/** Structured table grid with cell-level data. */
|
|
111
|
+
export interface WasmTableGrid {
|
|
112
|
+
rows: number;
|
|
113
|
+
cols: number;
|
|
114
|
+
cells: WasmGridCell[];
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/** A table extracted during conversion. */
|
|
118
|
+
export interface WasmConversionTable {
|
|
119
|
+
grid: WasmTableGrid;
|
|
120
|
+
markdown: string;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/** Non-fatal warning emitted during conversion. */
|
|
124
|
+
export interface WasmConversionWarning {
|
|
125
|
+
/** Human-readable warning message. */
|
|
126
|
+
message: string;
|
|
127
|
+
/** Warning kind identifier. */
|
|
128
|
+
kind: string;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/** An extracted inline image from the HTML document. */
|
|
132
|
+
export interface WasmInlineImage {
|
|
133
|
+
/** Raw image data as a Uint8Array. */
|
|
134
|
+
data: Uint8Array;
|
|
135
|
+
/** Image format (png, jpeg, gif, svg, etc.). */
|
|
136
|
+
format: string;
|
|
137
|
+
/** Generated or provided filename, or null. */
|
|
138
|
+
filename: string | null;
|
|
139
|
+
/** Alt text or description, or null. */
|
|
140
|
+
description: string | null;
|
|
141
|
+
/** Image width in pixels, or null if not available. */
|
|
142
|
+
width: number | null;
|
|
143
|
+
/** Image height in pixels, or null if not available. */
|
|
144
|
+
height: number | null;
|
|
145
|
+
/** Source type ("img_data_uri" or "svg_element"). */
|
|
146
|
+
source: string;
|
|
147
|
+
/** HTML attributes from the source element. */
|
|
148
|
+
attributes: Record<string, string>;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/** Result of the convert() API. */
|
|
152
|
+
export interface WasmConversionResult {
|
|
153
|
+
/** Converted text output (markdown, djot, or plain text), or null. */
|
|
154
|
+
content: string | null;
|
|
155
|
+
/** Structured document tree serialized as a JSON value, or null. */
|
|
156
|
+
document: unknown | null;
|
|
157
|
+
/** Extracted HTML metadata serialized as a JSON value, or null. */
|
|
158
|
+
metadata: unknown | null;
|
|
159
|
+
/** All tables found in the HTML, in document order. */
|
|
160
|
+
tables: WasmConversionTable[];
|
|
161
|
+
/** Extracted inline images (data URIs and SVGs). */
|
|
162
|
+
images: WasmInlineImage[];
|
|
163
|
+
/** Non-fatal processing warnings. */
|
|
164
|
+
warnings: WasmConversionWarning[];
|
|
90
165
|
}
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
* ```
|
|
28
28
|
* @param {string} html
|
|
29
29
|
* @param {WasmConversionOptions | null | undefined} [options]
|
|
30
|
-
* @returns {
|
|
30
|
+
* @returns {WasmConversionResult}
|
|
31
31
|
*/
|
|
32
32
|
export function convert(html, options) {
|
|
33
33
|
try {
|
|
@@ -53,11 +53,11 @@ export function convert(html, options) {
|
|
|
53
53
|
export function init() {
|
|
54
54
|
wasm.init();
|
|
55
55
|
}
|
|
56
|
-
export function
|
|
56
|
+
export function __wbg_Error_7c536b7a8123d334(arg0, arg1) {
|
|
57
57
|
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
58
58
|
return addHeapObject(ret);
|
|
59
59
|
}
|
|
60
|
-
export function
|
|
60
|
+
export function __wbg_Number_d2ed9f811fff7051(arg0) {
|
|
61
61
|
const ret = Number(getObject(arg0));
|
|
62
62
|
return ret;
|
|
63
63
|
}
|
|
@@ -68,68 +68,68 @@ export function __wbg_String_8564e559799eccda(arg0, arg1) {
|
|
|
68
68
|
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
69
69
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
70
70
|
}
|
|
71
|
-
export function
|
|
71
|
+
export function __wbg___wbindgen_bigint_get_as_i64_3d66614a210167c9(arg0, arg1) {
|
|
72
72
|
const v = getObject(arg1);
|
|
73
73
|
const ret = typeof(v) === 'bigint' ? v : undefined;
|
|
74
74
|
getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
|
|
75
75
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
76
76
|
}
|
|
77
|
-
export function
|
|
77
|
+
export function __wbg___wbindgen_boolean_get_6abe7d340f528f63(arg0) {
|
|
78
78
|
const v = getObject(arg0);
|
|
79
79
|
const ret = typeof(v) === 'boolean' ? v : undefined;
|
|
80
80
|
return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
|
|
81
81
|
}
|
|
82
|
-
export function
|
|
82
|
+
export function __wbg___wbindgen_debug_string_8baecc377ad92880(arg0, arg1) {
|
|
83
83
|
const ret = debugString(getObject(arg1));
|
|
84
84
|
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
85
85
|
const len1 = WASM_VECTOR_LEN;
|
|
86
86
|
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
87
87
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
88
88
|
}
|
|
89
|
-
export function
|
|
89
|
+
export function __wbg___wbindgen_in_840bcdd0dba8d13c(arg0, arg1) {
|
|
90
90
|
const ret = getObject(arg0) in getObject(arg1);
|
|
91
91
|
return ret;
|
|
92
92
|
}
|
|
93
|
-
export function
|
|
93
|
+
export function __wbg___wbindgen_is_bigint_4393a1b8e13fdf64(arg0) {
|
|
94
94
|
const ret = typeof(getObject(arg0)) === 'bigint';
|
|
95
95
|
return ret;
|
|
96
96
|
}
|
|
97
|
-
export function
|
|
97
|
+
export function __wbg___wbindgen_is_function_d4c2480b46f29e33(arg0) {
|
|
98
98
|
const ret = typeof(getObject(arg0)) === 'function';
|
|
99
99
|
return ret;
|
|
100
100
|
}
|
|
101
|
-
export function
|
|
101
|
+
export function __wbg___wbindgen_is_null_77356bc8da6bb199(arg0) {
|
|
102
102
|
const ret = getObject(arg0) === null;
|
|
103
103
|
return ret;
|
|
104
104
|
}
|
|
105
|
-
export function
|
|
105
|
+
export function __wbg___wbindgen_is_object_e04e3a51a90cde43(arg0) {
|
|
106
106
|
const val = getObject(arg0);
|
|
107
107
|
const ret = typeof(val) === 'object' && val !== null;
|
|
108
108
|
return ret;
|
|
109
109
|
}
|
|
110
|
-
export function
|
|
110
|
+
export function __wbg___wbindgen_is_string_3db04af369717583(arg0) {
|
|
111
111
|
const ret = typeof(getObject(arg0)) === 'string';
|
|
112
112
|
return ret;
|
|
113
113
|
}
|
|
114
|
-
export function
|
|
114
|
+
export function __wbg___wbindgen_is_undefined_5957b329897cc39c(arg0) {
|
|
115
115
|
const ret = getObject(arg0) === undefined;
|
|
116
116
|
return ret;
|
|
117
117
|
}
|
|
118
|
-
export function
|
|
118
|
+
export function __wbg___wbindgen_jsval_eq_8d2fb89b36afbec9(arg0, arg1) {
|
|
119
119
|
const ret = getObject(arg0) === getObject(arg1);
|
|
120
120
|
return ret;
|
|
121
121
|
}
|
|
122
|
-
export function
|
|
122
|
+
export function __wbg___wbindgen_jsval_loose_eq_54779efa0bc46b0b(arg0, arg1) {
|
|
123
123
|
const ret = getObject(arg0) == getObject(arg1);
|
|
124
124
|
return ret;
|
|
125
125
|
}
|
|
126
|
-
export function
|
|
126
|
+
export function __wbg___wbindgen_number_get_4fcba947d278ad7c(arg0, arg1) {
|
|
127
127
|
const obj = getObject(arg1);
|
|
128
128
|
const ret = typeof(obj) === 'number' ? obj : undefined;
|
|
129
129
|
getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
|
|
130
130
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
131
131
|
}
|
|
132
|
-
export function
|
|
132
|
+
export function __wbg___wbindgen_string_get_ae6081df8158aa73(arg0, arg1) {
|
|
133
133
|
const obj = getObject(arg1);
|
|
134
134
|
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
135
135
|
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
@@ -137,18 +137,18 @@ export function __wbg___wbindgen_string_get_f1161390414f9b59(arg0, arg1) {
|
|
|
137
137
|
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
138
138
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
139
139
|
}
|
|
140
|
-
export function
|
|
140
|
+
export function __wbg___wbindgen_throw_bd5a70920abf0236(arg0, arg1) {
|
|
141
141
|
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
142
142
|
}
|
|
143
|
-
export function
|
|
143
|
+
export function __wbg_call_faf6b66fc4667ce6() { return handleError(function (arg0, arg1) {
|
|
144
144
|
const ret = getObject(arg0).call(getObject(arg1));
|
|
145
145
|
return addHeapObject(ret);
|
|
146
146
|
}, arguments); }
|
|
147
|
-
export function
|
|
147
|
+
export function __wbg_codePointAt_7b7b91ae3899dfad(arg0, arg1) {
|
|
148
148
|
const ret = getObject(arg0).codePointAt(arg1 >>> 0);
|
|
149
149
|
return addHeapObject(ret);
|
|
150
150
|
}
|
|
151
|
-
export function
|
|
151
|
+
export function __wbg_done_e0b2820e599cb9f4(arg0) {
|
|
152
152
|
const ret = getObject(arg0).done;
|
|
153
153
|
return ret;
|
|
154
154
|
}
|
|
@@ -163,11 +163,11 @@ export function __wbg_error_a6fa202b58aa1cd3(arg0, arg1) {
|
|
|
163
163
|
wasm.__wbindgen_export4(deferred0_0, deferred0_1, 1);
|
|
164
164
|
}
|
|
165
165
|
}
|
|
166
|
-
export function
|
|
166
|
+
export function __wbg_get_97a4b9029a97fbd6() { return handleError(function (arg0, arg1) {
|
|
167
167
|
const ret = Reflect.get(getObject(arg0), getObject(arg1));
|
|
168
168
|
return addHeapObject(ret);
|
|
169
169
|
}, arguments); }
|
|
170
|
-
export function
|
|
170
|
+
export function __wbg_get_unchecked_c33f0e513c522d7c(arg0, arg1) {
|
|
171
171
|
const ret = getObject(arg0)[arg1 >>> 0];
|
|
172
172
|
return addHeapObject(ret);
|
|
173
173
|
}
|
|
@@ -175,7 +175,7 @@ export function __wbg_get_with_ref_key_6412cf3094599694(arg0, arg1) {
|
|
|
175
175
|
const ret = getObject(arg0)[getObject(arg1)];
|
|
176
176
|
return addHeapObject(ret);
|
|
177
177
|
}
|
|
178
|
-
export function
|
|
178
|
+
export function __wbg_instanceof_ArrayBuffer_046631d47961f5fe(arg0) {
|
|
179
179
|
let result;
|
|
180
180
|
try {
|
|
181
181
|
result = getObject(arg0) instanceof ArrayBuffer;
|
|
@@ -185,7 +185,7 @@ export function __wbg_instanceof_ArrayBuffer_8d855993947fc3a2(arg0) {
|
|
|
185
185
|
const ret = result;
|
|
186
186
|
return ret;
|
|
187
187
|
}
|
|
188
|
-
export function
|
|
188
|
+
export function __wbg_instanceof_Object_a99dcb8b396fa196(arg0) {
|
|
189
189
|
let result;
|
|
190
190
|
try {
|
|
191
191
|
result = getObject(arg0) instanceof Object;
|
|
@@ -195,7 +195,7 @@ export function __wbg_instanceof_Object_d622a5764f4f9002(arg0) {
|
|
|
195
195
|
const ret = result;
|
|
196
196
|
return ret;
|
|
197
197
|
}
|
|
198
|
-
export function
|
|
198
|
+
export function __wbg_instanceof_Uint8Array_e7d245baab296394(arg0) {
|
|
199
199
|
let result;
|
|
200
200
|
try {
|
|
201
201
|
result = getObject(arg0) instanceof Uint8Array;
|
|
@@ -205,87 +205,87 @@ export function __wbg_instanceof_Uint8Array_ce24d58a5f4bdcc3(arg0) {
|
|
|
205
205
|
const ret = result;
|
|
206
206
|
return ret;
|
|
207
207
|
}
|
|
208
|
-
export function
|
|
208
|
+
export function __wbg_isArray_8dc932f4b6997756(arg0) {
|
|
209
209
|
const ret = Array.isArray(getObject(arg0));
|
|
210
210
|
return ret;
|
|
211
211
|
}
|
|
212
|
-
export function
|
|
212
|
+
export function __wbg_isSafeInteger_db44a36710ec7a10(arg0) {
|
|
213
213
|
const ret = Number.isSafeInteger(getObject(arg0));
|
|
214
214
|
return ret;
|
|
215
215
|
}
|
|
216
|
-
export function
|
|
216
|
+
export function __wbg_iterator_8af67730d17a1376() {
|
|
217
217
|
const ret = Symbol.iterator;
|
|
218
218
|
return addHeapObject(ret);
|
|
219
219
|
}
|
|
220
|
-
export function
|
|
220
|
+
export function __wbg_keys_696ffd3069bfa716(arg0) {
|
|
221
221
|
const ret = Object.keys(getObject(arg0));
|
|
222
222
|
return addHeapObject(ret);
|
|
223
223
|
}
|
|
224
|
-
export function
|
|
224
|
+
export function __wbg_length_090b6aa6235450ba(arg0) {
|
|
225
225
|
const ret = getObject(arg0).length;
|
|
226
226
|
return ret;
|
|
227
227
|
}
|
|
228
|
-
export function
|
|
228
|
+
export function __wbg_length_713cc1160ce7b5b9(arg0) {
|
|
229
229
|
const ret = getObject(arg0).length;
|
|
230
230
|
return ret;
|
|
231
231
|
}
|
|
232
|
-
export function
|
|
232
|
+
export function __wbg_length_8aeeb5332e9096f0(arg0) {
|
|
233
233
|
const ret = getObject(arg0).length;
|
|
234
234
|
return ret;
|
|
235
235
|
}
|
|
236
|
-
export function
|
|
237
|
-
const ret = new
|
|
236
|
+
export function __wbg_new_227d7c05414eb861() {
|
|
237
|
+
const ret = new Error();
|
|
238
238
|
return addHeapObject(ret);
|
|
239
239
|
}
|
|
240
|
-
export function
|
|
240
|
+
export function __wbg_new_4774b8d4db1224e4(arg0) {
|
|
241
241
|
const ret = new Uint8Array(getObject(arg0));
|
|
242
242
|
return addHeapObject(ret);
|
|
243
243
|
}
|
|
244
|
-
export function
|
|
245
|
-
const ret = new
|
|
244
|
+
export function __wbg_new_480195ddf7042529() {
|
|
245
|
+
const ret = new Array();
|
|
246
246
|
return addHeapObject(ret);
|
|
247
247
|
}
|
|
248
|
-
export function
|
|
249
|
-
const ret = new
|
|
248
|
+
export function __wbg_new_d63f24ca072fa278() {
|
|
249
|
+
const ret = new Map();
|
|
250
250
|
return addHeapObject(ret);
|
|
251
251
|
}
|
|
252
|
-
export function
|
|
252
|
+
export function __wbg_new_e4597c3f125a2038() {
|
|
253
253
|
const ret = new Object();
|
|
254
254
|
return addHeapObject(ret);
|
|
255
255
|
}
|
|
256
|
-
export function
|
|
256
|
+
export function __wbg_new_from_slice_2733a138cec5cdcf(arg0, arg1) {
|
|
257
257
|
const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1));
|
|
258
258
|
return addHeapObject(ret);
|
|
259
259
|
}
|
|
260
|
-
export function
|
|
261
|
-
const ret = getObject(arg0).next;
|
|
262
|
-
return addHeapObject(ret);
|
|
263
|
-
}
|
|
264
|
-
export function __wbg_next_e34cfb9df1518d7c() { return handleError(function (arg0) {
|
|
260
|
+
export function __wbg_next_9a5990d0355cdd1a() { return handleError(function (arg0) {
|
|
265
261
|
const ret = getObject(arg0).next();
|
|
266
262
|
return addHeapObject(ret);
|
|
267
263
|
}, arguments); }
|
|
268
|
-
export function
|
|
264
|
+
export function __wbg_next_e75ce91d696d3c0f(arg0) {
|
|
265
|
+
const ret = getObject(arg0).next;
|
|
266
|
+
return addHeapObject(ret);
|
|
267
|
+
}
|
|
268
|
+
export function __wbg_prototypesetcall_7dca54d31cb9d2dc(arg0, arg1, arg2) {
|
|
269
269
|
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), getObject(arg2));
|
|
270
270
|
}
|
|
271
|
-
export function
|
|
271
|
+
export function __wbg_push_bb0def92a641d074(arg0, arg1) {
|
|
272
272
|
const ret = getObject(arg0).push(getObject(arg1));
|
|
273
273
|
return ret;
|
|
274
274
|
}
|
|
275
|
-
export function
|
|
276
|
-
getObject(arg0)
|
|
277
|
-
|
|
275
|
+
export function __wbg_set_05b085c909633819() { return handleError(function (arg0, arg1, arg2) {
|
|
276
|
+
const ret = Reflect.set(getObject(arg0), getObject(arg1), getObject(arg2));
|
|
277
|
+
return ret;
|
|
278
|
+
}, arguments); }
|
|
278
279
|
export function __wbg_set_6be42768c690e380(arg0, arg1, arg2) {
|
|
279
280
|
getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
|
|
280
281
|
}
|
|
281
|
-
export function
|
|
282
|
+
export function __wbg_set_84911e1f7639680c(arg0, arg1, arg2) {
|
|
282
283
|
const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
|
|
283
284
|
return addHeapObject(ret);
|
|
284
285
|
}
|
|
285
|
-
export function
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
}, arguments); }
|
|
286
|
+
export function __wbg_set_c78f0ccf7c3f53b7(arg0, arg1, arg2) {
|
|
287
|
+
getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
|
|
288
|
+
}
|
|
289
289
|
export function __wbg_stack_3b0d974bbf31e44f(arg0, arg1) {
|
|
290
290
|
const ret = getObject(arg1).stack;
|
|
291
291
|
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
@@ -293,7 +293,7 @@ export function __wbg_stack_3b0d974bbf31e44f(arg0, arg1) {
|
|
|
293
293
|
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
294
294
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
295
295
|
}
|
|
296
|
-
export function
|
|
296
|
+
export function __wbg_value_8996dd08e99f9529(arg0) {
|
|
297
297
|
const ret = getObject(arg0).value;
|
|
298
298
|
return addHeapObject(ret);
|
|
299
299
|
}
|
|
Binary file
|
package/dist/package.json
CHANGED
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
* console.log(result.warnings); // []
|
|
30
30
|
* ```
|
|
31
31
|
*/
|
|
32
|
-
export function convert(html: string, options?: WasmConversionOptions | null):
|
|
32
|
+
export function convert(html: string, options?: WasmConversionOptions | null): WasmConversionResult;
|
|
33
33
|
|
|
34
34
|
/**
|
|
35
35
|
* Initialize panic hook for better error messages in the browser
|
|
@@ -44,6 +44,7 @@ export type WasmNewlineStyle = "spaces" | "backslash";
|
|
|
44
44
|
export type WasmCodeBlockStyle = "indented" | "backticks" | "tildes";
|
|
45
45
|
export type WasmHighlightStyle = "doubleEqual" | "html" | "bold" | "none";
|
|
46
46
|
export type WasmPreprocessingPreset = "minimal" | "standard" | "aggressive";
|
|
47
|
+
export type WasmOutputFormat = "markdown" | "djot" | "plain";
|
|
47
48
|
|
|
48
49
|
export interface WasmPreprocessingOptions {
|
|
49
50
|
enabled?: boolean;
|
|
@@ -84,4 +85,78 @@ export interface WasmConversionOptions {
|
|
|
84
85
|
debug?: boolean;
|
|
85
86
|
stripTags?: string[];
|
|
86
87
|
preserveTags?: string[];
|
|
88
|
+
skipImages?: boolean;
|
|
89
|
+
outputFormat?: WasmOutputFormat;
|
|
90
|
+
includeDocumentStructure?: boolean;
|
|
91
|
+
extractImages?: boolean;
|
|
92
|
+
maxImageSize?: number;
|
|
93
|
+
captureSvg?: boolean;
|
|
94
|
+
inferDimensions?: boolean;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/** A single cell in a structured table grid. */
|
|
98
|
+
export interface WasmGridCell {
|
|
99
|
+
content: string;
|
|
100
|
+
row: number;
|
|
101
|
+
col: number;
|
|
102
|
+
rowSpan: number;
|
|
103
|
+
colSpan: number;
|
|
104
|
+
isHeader: boolean;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/** Structured table grid with cell-level data. */
|
|
108
|
+
export interface WasmTableGrid {
|
|
109
|
+
rows: number;
|
|
110
|
+
cols: number;
|
|
111
|
+
cells: WasmGridCell[];
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/** A table extracted during conversion. */
|
|
115
|
+
export interface WasmConversionTable {
|
|
116
|
+
grid: WasmTableGrid;
|
|
117
|
+
markdown: string;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/** Non-fatal warning emitted during conversion. */
|
|
121
|
+
export interface WasmConversionWarning {
|
|
122
|
+
/** Human-readable warning message. */
|
|
123
|
+
message: string;
|
|
124
|
+
/** Warning kind identifier. */
|
|
125
|
+
kind: string;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/** An extracted inline image from the HTML document. */
|
|
129
|
+
export interface WasmInlineImage {
|
|
130
|
+
/** Raw image data as a Uint8Array. */
|
|
131
|
+
data: Uint8Array;
|
|
132
|
+
/** Image format (png, jpeg, gif, svg, etc.). */
|
|
133
|
+
format: string;
|
|
134
|
+
/** Generated or provided filename, or null. */
|
|
135
|
+
filename: string | null;
|
|
136
|
+
/** Alt text or description, or null. */
|
|
137
|
+
description: string | null;
|
|
138
|
+
/** Image width in pixels, or null if not available. */
|
|
139
|
+
width: number | null;
|
|
140
|
+
/** Image height in pixels, or null if not available. */
|
|
141
|
+
height: number | null;
|
|
142
|
+
/** Source type ("img_data_uri" or "svg_element"). */
|
|
143
|
+
source: string;
|
|
144
|
+
/** HTML attributes from the source element. */
|
|
145
|
+
attributes: Record<string, string>;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/** Result of the convert() API. */
|
|
149
|
+
export interface WasmConversionResult {
|
|
150
|
+
/** Converted text output (markdown, djot, or plain text), or null. */
|
|
151
|
+
content: string | null;
|
|
152
|
+
/** Structured document tree serialized as a JSON value, or null. */
|
|
153
|
+
document: unknown | null;
|
|
154
|
+
/** Extracted HTML metadata serialized as a JSON value, or null. */
|
|
155
|
+
metadata: unknown | null;
|
|
156
|
+
/** All tables found in the HTML, in document order. */
|
|
157
|
+
tables: WasmConversionTable[];
|
|
158
|
+
/** Extracted inline images (data URIs and SVGs). */
|
|
159
|
+
images: WasmInlineImage[];
|
|
160
|
+
/** Non-fatal processing warnings. */
|
|
161
|
+
warnings: WasmConversionWarning[];
|
|
87
162
|
}
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
* ```
|
|
34
34
|
* @param {string} html
|
|
35
35
|
* @param {WasmConversionOptions | null | undefined} [options]
|
|
36
|
-
* @returns {
|
|
36
|
+
* @returns {WasmConversionResult}
|
|
37
37
|
*/
|
|
38
38
|
function convert(html, options) {
|
|
39
39
|
try {
|
|
@@ -65,11 +65,11 @@ exports.init = init;
|
|
|
65
65
|
function __wbg_get_imports() {
|
|
66
66
|
const import0 = {
|
|
67
67
|
__proto__: null,
|
|
68
|
-
|
|
68
|
+
__wbg_Error_7c536b7a8123d334: function(arg0, arg1) {
|
|
69
69
|
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
70
70
|
return addHeapObject(ret);
|
|
71
71
|
},
|
|
72
|
-
|
|
72
|
+
__wbg_Number_d2ed9f811fff7051: function(arg0) {
|
|
73
73
|
const ret = Number(getObject(arg0));
|
|
74
74
|
return ret;
|
|
75
75
|
},
|
|
@@ -80,68 +80,68 @@ function __wbg_get_imports() {
|
|
|
80
80
|
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
81
81
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
82
82
|
},
|
|
83
|
-
|
|
83
|
+
__wbg___wbindgen_bigint_get_as_i64_3d66614a210167c9: function(arg0, arg1) {
|
|
84
84
|
const v = getObject(arg1);
|
|
85
85
|
const ret = typeof(v) === 'bigint' ? v : undefined;
|
|
86
86
|
getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
|
|
87
87
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
88
88
|
},
|
|
89
|
-
|
|
89
|
+
__wbg___wbindgen_boolean_get_6abe7d340f528f63: function(arg0) {
|
|
90
90
|
const v = getObject(arg0);
|
|
91
91
|
const ret = typeof(v) === 'boolean' ? v : undefined;
|
|
92
92
|
return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
|
|
93
93
|
},
|
|
94
|
-
|
|
94
|
+
__wbg___wbindgen_debug_string_8baecc377ad92880: function(arg0, arg1) {
|
|
95
95
|
const ret = debugString(getObject(arg1));
|
|
96
96
|
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
97
97
|
const len1 = WASM_VECTOR_LEN;
|
|
98
98
|
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
99
99
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
100
100
|
},
|
|
101
|
-
|
|
101
|
+
__wbg___wbindgen_in_840bcdd0dba8d13c: function(arg0, arg1) {
|
|
102
102
|
const ret = getObject(arg0) in getObject(arg1);
|
|
103
103
|
return ret;
|
|
104
104
|
},
|
|
105
|
-
|
|
105
|
+
__wbg___wbindgen_is_bigint_4393a1b8e13fdf64: function(arg0) {
|
|
106
106
|
const ret = typeof(getObject(arg0)) === 'bigint';
|
|
107
107
|
return ret;
|
|
108
108
|
},
|
|
109
|
-
|
|
109
|
+
__wbg___wbindgen_is_function_d4c2480b46f29e33: function(arg0) {
|
|
110
110
|
const ret = typeof(getObject(arg0)) === 'function';
|
|
111
111
|
return ret;
|
|
112
112
|
},
|
|
113
|
-
|
|
113
|
+
__wbg___wbindgen_is_null_77356bc8da6bb199: function(arg0) {
|
|
114
114
|
const ret = getObject(arg0) === null;
|
|
115
115
|
return ret;
|
|
116
116
|
},
|
|
117
|
-
|
|
117
|
+
__wbg___wbindgen_is_object_e04e3a51a90cde43: function(arg0) {
|
|
118
118
|
const val = getObject(arg0);
|
|
119
119
|
const ret = typeof(val) === 'object' && val !== null;
|
|
120
120
|
return ret;
|
|
121
121
|
},
|
|
122
|
-
|
|
122
|
+
__wbg___wbindgen_is_string_3db04af369717583: function(arg0) {
|
|
123
123
|
const ret = typeof(getObject(arg0)) === 'string';
|
|
124
124
|
return ret;
|
|
125
125
|
},
|
|
126
|
-
|
|
126
|
+
__wbg___wbindgen_is_undefined_5957b329897cc39c: function(arg0) {
|
|
127
127
|
const ret = getObject(arg0) === undefined;
|
|
128
128
|
return ret;
|
|
129
129
|
},
|
|
130
|
-
|
|
130
|
+
__wbg___wbindgen_jsval_eq_8d2fb89b36afbec9: function(arg0, arg1) {
|
|
131
131
|
const ret = getObject(arg0) === getObject(arg1);
|
|
132
132
|
return ret;
|
|
133
133
|
},
|
|
134
|
-
|
|
134
|
+
__wbg___wbindgen_jsval_loose_eq_54779efa0bc46b0b: function(arg0, arg1) {
|
|
135
135
|
const ret = getObject(arg0) == getObject(arg1);
|
|
136
136
|
return ret;
|
|
137
137
|
},
|
|
138
|
-
|
|
138
|
+
__wbg___wbindgen_number_get_4fcba947d278ad7c: function(arg0, arg1) {
|
|
139
139
|
const obj = getObject(arg1);
|
|
140
140
|
const ret = typeof(obj) === 'number' ? obj : undefined;
|
|
141
141
|
getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
|
|
142
142
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
143
143
|
},
|
|
144
|
-
|
|
144
|
+
__wbg___wbindgen_string_get_ae6081df8158aa73: function(arg0, arg1) {
|
|
145
145
|
const obj = getObject(arg1);
|
|
146
146
|
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
147
147
|
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
@@ -149,18 +149,18 @@ function __wbg_get_imports() {
|
|
|
149
149
|
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
150
150
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
151
151
|
},
|
|
152
|
-
|
|
152
|
+
__wbg___wbindgen_throw_bd5a70920abf0236: function(arg0, arg1) {
|
|
153
153
|
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
154
154
|
},
|
|
155
|
-
|
|
155
|
+
__wbg_call_faf6b66fc4667ce6: function() { return handleError(function (arg0, arg1) {
|
|
156
156
|
const ret = getObject(arg0).call(getObject(arg1));
|
|
157
157
|
return addHeapObject(ret);
|
|
158
158
|
}, arguments); },
|
|
159
|
-
|
|
159
|
+
__wbg_codePointAt_7b7b91ae3899dfad: function(arg0, arg1) {
|
|
160
160
|
const ret = getObject(arg0).codePointAt(arg1 >>> 0);
|
|
161
161
|
return addHeapObject(ret);
|
|
162
162
|
},
|
|
163
|
-
|
|
163
|
+
__wbg_done_e0b2820e599cb9f4: function(arg0) {
|
|
164
164
|
const ret = getObject(arg0).done;
|
|
165
165
|
return ret;
|
|
166
166
|
},
|
|
@@ -175,11 +175,11 @@ function __wbg_get_imports() {
|
|
|
175
175
|
wasm.__wbindgen_export4(deferred0_0, deferred0_1, 1);
|
|
176
176
|
}
|
|
177
177
|
},
|
|
178
|
-
|
|
178
|
+
__wbg_get_97a4b9029a97fbd6: function() { return handleError(function (arg0, arg1) {
|
|
179
179
|
const ret = Reflect.get(getObject(arg0), getObject(arg1));
|
|
180
180
|
return addHeapObject(ret);
|
|
181
181
|
}, arguments); },
|
|
182
|
-
|
|
182
|
+
__wbg_get_unchecked_c33f0e513c522d7c: function(arg0, arg1) {
|
|
183
183
|
const ret = getObject(arg0)[arg1 >>> 0];
|
|
184
184
|
return addHeapObject(ret);
|
|
185
185
|
},
|
|
@@ -187,7 +187,7 @@ function __wbg_get_imports() {
|
|
|
187
187
|
const ret = getObject(arg0)[getObject(arg1)];
|
|
188
188
|
return addHeapObject(ret);
|
|
189
189
|
},
|
|
190
|
-
|
|
190
|
+
__wbg_instanceof_ArrayBuffer_046631d47961f5fe: function(arg0) {
|
|
191
191
|
let result;
|
|
192
192
|
try {
|
|
193
193
|
result = getObject(arg0) instanceof ArrayBuffer;
|
|
@@ -197,7 +197,7 @@ function __wbg_get_imports() {
|
|
|
197
197
|
const ret = result;
|
|
198
198
|
return ret;
|
|
199
199
|
},
|
|
200
|
-
|
|
200
|
+
__wbg_instanceof_Object_a99dcb8b396fa196: function(arg0) {
|
|
201
201
|
let result;
|
|
202
202
|
try {
|
|
203
203
|
result = getObject(arg0) instanceof Object;
|
|
@@ -207,7 +207,7 @@ function __wbg_get_imports() {
|
|
|
207
207
|
const ret = result;
|
|
208
208
|
return ret;
|
|
209
209
|
},
|
|
210
|
-
|
|
210
|
+
__wbg_instanceof_Uint8Array_e7d245baab296394: function(arg0) {
|
|
211
211
|
let result;
|
|
212
212
|
try {
|
|
213
213
|
result = getObject(arg0) instanceof Uint8Array;
|
|
@@ -217,87 +217,87 @@ function __wbg_get_imports() {
|
|
|
217
217
|
const ret = result;
|
|
218
218
|
return ret;
|
|
219
219
|
},
|
|
220
|
-
|
|
220
|
+
__wbg_isArray_8dc932f4b6997756: function(arg0) {
|
|
221
221
|
const ret = Array.isArray(getObject(arg0));
|
|
222
222
|
return ret;
|
|
223
223
|
},
|
|
224
|
-
|
|
224
|
+
__wbg_isSafeInteger_db44a36710ec7a10: function(arg0) {
|
|
225
225
|
const ret = Number.isSafeInteger(getObject(arg0));
|
|
226
226
|
return ret;
|
|
227
227
|
},
|
|
228
|
-
|
|
228
|
+
__wbg_iterator_8af67730d17a1376: function() {
|
|
229
229
|
const ret = Symbol.iterator;
|
|
230
230
|
return addHeapObject(ret);
|
|
231
231
|
},
|
|
232
|
-
|
|
232
|
+
__wbg_keys_696ffd3069bfa716: function(arg0) {
|
|
233
233
|
const ret = Object.keys(getObject(arg0));
|
|
234
234
|
return addHeapObject(ret);
|
|
235
235
|
},
|
|
236
|
-
|
|
236
|
+
__wbg_length_090b6aa6235450ba: function(arg0) {
|
|
237
237
|
const ret = getObject(arg0).length;
|
|
238
238
|
return ret;
|
|
239
239
|
},
|
|
240
|
-
|
|
240
|
+
__wbg_length_713cc1160ce7b5b9: function(arg0) {
|
|
241
241
|
const ret = getObject(arg0).length;
|
|
242
242
|
return ret;
|
|
243
243
|
},
|
|
244
|
-
|
|
244
|
+
__wbg_length_8aeeb5332e9096f0: function(arg0) {
|
|
245
245
|
const ret = getObject(arg0).length;
|
|
246
246
|
return ret;
|
|
247
247
|
},
|
|
248
|
-
|
|
249
|
-
const ret = new
|
|
248
|
+
__wbg_new_227d7c05414eb861: function() {
|
|
249
|
+
const ret = new Error();
|
|
250
250
|
return addHeapObject(ret);
|
|
251
251
|
},
|
|
252
|
-
|
|
252
|
+
__wbg_new_4774b8d4db1224e4: function(arg0) {
|
|
253
253
|
const ret = new Uint8Array(getObject(arg0));
|
|
254
254
|
return addHeapObject(ret);
|
|
255
255
|
},
|
|
256
|
-
|
|
257
|
-
const ret = new
|
|
256
|
+
__wbg_new_480195ddf7042529: function() {
|
|
257
|
+
const ret = new Array();
|
|
258
258
|
return addHeapObject(ret);
|
|
259
259
|
},
|
|
260
|
-
|
|
261
|
-
const ret = new
|
|
260
|
+
__wbg_new_d63f24ca072fa278: function() {
|
|
261
|
+
const ret = new Map();
|
|
262
262
|
return addHeapObject(ret);
|
|
263
263
|
},
|
|
264
|
-
|
|
264
|
+
__wbg_new_e4597c3f125a2038: function() {
|
|
265
265
|
const ret = new Object();
|
|
266
266
|
return addHeapObject(ret);
|
|
267
267
|
},
|
|
268
|
-
|
|
268
|
+
__wbg_new_from_slice_2733a138cec5cdcf: function(arg0, arg1) {
|
|
269
269
|
const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1));
|
|
270
270
|
return addHeapObject(ret);
|
|
271
271
|
},
|
|
272
|
-
|
|
273
|
-
const ret = getObject(arg0).next;
|
|
274
|
-
return addHeapObject(ret);
|
|
275
|
-
},
|
|
276
|
-
__wbg_next_e34cfb9df1518d7c: function() { return handleError(function (arg0) {
|
|
272
|
+
__wbg_next_9a5990d0355cdd1a: function() { return handleError(function (arg0) {
|
|
277
273
|
const ret = getObject(arg0).next();
|
|
278
274
|
return addHeapObject(ret);
|
|
279
275
|
}, arguments); },
|
|
280
|
-
|
|
276
|
+
__wbg_next_e75ce91d696d3c0f: function(arg0) {
|
|
277
|
+
const ret = getObject(arg0).next;
|
|
278
|
+
return addHeapObject(ret);
|
|
279
|
+
},
|
|
280
|
+
__wbg_prototypesetcall_7dca54d31cb9d2dc: function(arg0, arg1, arg2) {
|
|
281
281
|
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), getObject(arg2));
|
|
282
282
|
},
|
|
283
|
-
|
|
283
|
+
__wbg_push_bb0def92a641d074: function(arg0, arg1) {
|
|
284
284
|
const ret = getObject(arg0).push(getObject(arg1));
|
|
285
285
|
return ret;
|
|
286
286
|
},
|
|
287
|
-
|
|
288
|
-
getObject(arg0)
|
|
289
|
-
|
|
287
|
+
__wbg_set_05b085c909633819: function() { return handleError(function (arg0, arg1, arg2) {
|
|
288
|
+
const ret = Reflect.set(getObject(arg0), getObject(arg1), getObject(arg2));
|
|
289
|
+
return ret;
|
|
290
|
+
}, arguments); },
|
|
290
291
|
__wbg_set_6be42768c690e380: function(arg0, arg1, arg2) {
|
|
291
292
|
getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
|
|
292
293
|
},
|
|
293
|
-
|
|
294
|
+
__wbg_set_84911e1f7639680c: function(arg0, arg1, arg2) {
|
|
294
295
|
const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
|
|
295
296
|
return addHeapObject(ret);
|
|
296
297
|
},
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
}, arguments); },
|
|
298
|
+
__wbg_set_c78f0ccf7c3f53b7: function(arg0, arg1, arg2) {
|
|
299
|
+
getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
|
|
300
|
+
},
|
|
301
301
|
__wbg_stack_3b0d974bbf31e44f: function(arg0, arg1) {
|
|
302
302
|
const ret = getObject(arg1).stack;
|
|
303
303
|
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
@@ -305,7 +305,7 @@ function __wbg_get_imports() {
|
|
|
305
305
|
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
306
306
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
307
307
|
},
|
|
308
|
-
|
|
308
|
+
__wbg_value_8996dd08e99f9529: function(arg0) {
|
|
309
309
|
const ret = getObject(arg0).value;
|
|
310
310
|
return addHeapObject(ret);
|
|
311
311
|
},
|
|
Binary file
|
package/dist-node/package.json
CHANGED
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
* console.log(result.warnings); // []
|
|
30
30
|
* ```
|
|
31
31
|
*/
|
|
32
|
-
export function convert(html: string, options?: WasmConversionOptions | null):
|
|
32
|
+
export function convert(html: string, options?: WasmConversionOptions | null): WasmConversionResult;
|
|
33
33
|
|
|
34
34
|
/**
|
|
35
35
|
* Initialize panic hook for better error messages in the browser
|
|
@@ -80,6 +80,7 @@ export type WasmNewlineStyle = "spaces" | "backslash";
|
|
|
80
80
|
export type WasmCodeBlockStyle = "indented" | "backticks" | "tildes";
|
|
81
81
|
export type WasmHighlightStyle = "doubleEqual" | "html" | "bold" | "none";
|
|
82
82
|
export type WasmPreprocessingPreset = "minimal" | "standard" | "aggressive";
|
|
83
|
+
export type WasmOutputFormat = "markdown" | "djot" | "plain";
|
|
83
84
|
|
|
84
85
|
export interface WasmPreprocessingOptions {
|
|
85
86
|
enabled?: boolean;
|
|
@@ -120,4 +121,78 @@ export interface WasmConversionOptions {
|
|
|
120
121
|
debug?: boolean;
|
|
121
122
|
stripTags?: string[];
|
|
122
123
|
preserveTags?: string[];
|
|
124
|
+
skipImages?: boolean;
|
|
125
|
+
outputFormat?: WasmOutputFormat;
|
|
126
|
+
includeDocumentStructure?: boolean;
|
|
127
|
+
extractImages?: boolean;
|
|
128
|
+
maxImageSize?: number;
|
|
129
|
+
captureSvg?: boolean;
|
|
130
|
+
inferDimensions?: boolean;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/** A single cell in a structured table grid. */
|
|
134
|
+
export interface WasmGridCell {
|
|
135
|
+
content: string;
|
|
136
|
+
row: number;
|
|
137
|
+
col: number;
|
|
138
|
+
rowSpan: number;
|
|
139
|
+
colSpan: number;
|
|
140
|
+
isHeader: boolean;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/** Structured table grid with cell-level data. */
|
|
144
|
+
export interface WasmTableGrid {
|
|
145
|
+
rows: number;
|
|
146
|
+
cols: number;
|
|
147
|
+
cells: WasmGridCell[];
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/** A table extracted during conversion. */
|
|
151
|
+
export interface WasmConversionTable {
|
|
152
|
+
grid: WasmTableGrid;
|
|
153
|
+
markdown: string;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/** Non-fatal warning emitted during conversion. */
|
|
157
|
+
export interface WasmConversionWarning {
|
|
158
|
+
/** Human-readable warning message. */
|
|
159
|
+
message: string;
|
|
160
|
+
/** Warning kind identifier. */
|
|
161
|
+
kind: string;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/** An extracted inline image from the HTML document. */
|
|
165
|
+
export interface WasmInlineImage {
|
|
166
|
+
/** Raw image data as a Uint8Array. */
|
|
167
|
+
data: Uint8Array;
|
|
168
|
+
/** Image format (png, jpeg, gif, svg, etc.). */
|
|
169
|
+
format: string;
|
|
170
|
+
/** Generated or provided filename, or null. */
|
|
171
|
+
filename: string | null;
|
|
172
|
+
/** Alt text or description, or null. */
|
|
173
|
+
description: string | null;
|
|
174
|
+
/** Image width in pixels, or null if not available. */
|
|
175
|
+
width: number | null;
|
|
176
|
+
/** Image height in pixels, or null if not available. */
|
|
177
|
+
height: number | null;
|
|
178
|
+
/** Source type ("img_data_uri" or "svg_element"). */
|
|
179
|
+
source: string;
|
|
180
|
+
/** HTML attributes from the source element. */
|
|
181
|
+
attributes: Record<string, string>;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/** Result of the convert() API. */
|
|
185
|
+
export interface WasmConversionResult {
|
|
186
|
+
/** Converted text output (markdown, djot, or plain text), or null. */
|
|
187
|
+
content: string | null;
|
|
188
|
+
/** Structured document tree serialized as a JSON value, or null. */
|
|
189
|
+
document: unknown | null;
|
|
190
|
+
/** Extracted HTML metadata serialized as a JSON value, or null. */
|
|
191
|
+
metadata: unknown | null;
|
|
192
|
+
/** All tables found in the HTML, in document order. */
|
|
193
|
+
tables: WasmConversionTable[];
|
|
194
|
+
/** Extracted inline images (data URIs and SVGs). */
|
|
195
|
+
images: WasmInlineImage[];
|
|
196
|
+
/** Non-fatal processing warnings. */
|
|
197
|
+
warnings: WasmConversionWarning[];
|
|
123
198
|
}
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
* ```
|
|
34
34
|
* @param {string} html
|
|
35
35
|
* @param {WasmConversionOptions | null | undefined} [options]
|
|
36
|
-
* @returns {
|
|
36
|
+
* @returns {WasmConversionResult}
|
|
37
37
|
*/
|
|
38
38
|
export function convert(html, options) {
|
|
39
39
|
try {
|
|
@@ -63,11 +63,11 @@ export function init() {
|
|
|
63
63
|
function __wbg_get_imports() {
|
|
64
64
|
const import0 = {
|
|
65
65
|
__proto__: null,
|
|
66
|
-
|
|
66
|
+
__wbg_Error_7c536b7a8123d334: function(arg0, arg1) {
|
|
67
67
|
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
68
68
|
return addHeapObject(ret);
|
|
69
69
|
},
|
|
70
|
-
|
|
70
|
+
__wbg_Number_d2ed9f811fff7051: function(arg0) {
|
|
71
71
|
const ret = Number(getObject(arg0));
|
|
72
72
|
return ret;
|
|
73
73
|
},
|
|
@@ -78,68 +78,68 @@ function __wbg_get_imports() {
|
|
|
78
78
|
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
79
79
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
80
80
|
},
|
|
81
|
-
|
|
81
|
+
__wbg___wbindgen_bigint_get_as_i64_3d66614a210167c9: function(arg0, arg1) {
|
|
82
82
|
const v = getObject(arg1);
|
|
83
83
|
const ret = typeof(v) === 'bigint' ? v : undefined;
|
|
84
84
|
getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
|
|
85
85
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
86
86
|
},
|
|
87
|
-
|
|
87
|
+
__wbg___wbindgen_boolean_get_6abe7d340f528f63: function(arg0) {
|
|
88
88
|
const v = getObject(arg0);
|
|
89
89
|
const ret = typeof(v) === 'boolean' ? v : undefined;
|
|
90
90
|
return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
|
|
91
91
|
},
|
|
92
|
-
|
|
92
|
+
__wbg___wbindgen_debug_string_8baecc377ad92880: function(arg0, arg1) {
|
|
93
93
|
const ret = debugString(getObject(arg1));
|
|
94
94
|
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
95
95
|
const len1 = WASM_VECTOR_LEN;
|
|
96
96
|
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
97
97
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
98
98
|
},
|
|
99
|
-
|
|
99
|
+
__wbg___wbindgen_in_840bcdd0dba8d13c: function(arg0, arg1) {
|
|
100
100
|
const ret = getObject(arg0) in getObject(arg1);
|
|
101
101
|
return ret;
|
|
102
102
|
},
|
|
103
|
-
|
|
103
|
+
__wbg___wbindgen_is_bigint_4393a1b8e13fdf64: function(arg0) {
|
|
104
104
|
const ret = typeof(getObject(arg0)) === 'bigint';
|
|
105
105
|
return ret;
|
|
106
106
|
},
|
|
107
|
-
|
|
107
|
+
__wbg___wbindgen_is_function_d4c2480b46f29e33: function(arg0) {
|
|
108
108
|
const ret = typeof(getObject(arg0)) === 'function';
|
|
109
109
|
return ret;
|
|
110
110
|
},
|
|
111
|
-
|
|
111
|
+
__wbg___wbindgen_is_null_77356bc8da6bb199: function(arg0) {
|
|
112
112
|
const ret = getObject(arg0) === null;
|
|
113
113
|
return ret;
|
|
114
114
|
},
|
|
115
|
-
|
|
115
|
+
__wbg___wbindgen_is_object_e04e3a51a90cde43: function(arg0) {
|
|
116
116
|
const val = getObject(arg0);
|
|
117
117
|
const ret = typeof(val) === 'object' && val !== null;
|
|
118
118
|
return ret;
|
|
119
119
|
},
|
|
120
|
-
|
|
120
|
+
__wbg___wbindgen_is_string_3db04af369717583: function(arg0) {
|
|
121
121
|
const ret = typeof(getObject(arg0)) === 'string';
|
|
122
122
|
return ret;
|
|
123
123
|
},
|
|
124
|
-
|
|
124
|
+
__wbg___wbindgen_is_undefined_5957b329897cc39c: function(arg0) {
|
|
125
125
|
const ret = getObject(arg0) === undefined;
|
|
126
126
|
return ret;
|
|
127
127
|
},
|
|
128
|
-
|
|
128
|
+
__wbg___wbindgen_jsval_eq_8d2fb89b36afbec9: function(arg0, arg1) {
|
|
129
129
|
const ret = getObject(arg0) === getObject(arg1);
|
|
130
130
|
return ret;
|
|
131
131
|
},
|
|
132
|
-
|
|
132
|
+
__wbg___wbindgen_jsval_loose_eq_54779efa0bc46b0b: function(arg0, arg1) {
|
|
133
133
|
const ret = getObject(arg0) == getObject(arg1);
|
|
134
134
|
return ret;
|
|
135
135
|
},
|
|
136
|
-
|
|
136
|
+
__wbg___wbindgen_number_get_4fcba947d278ad7c: function(arg0, arg1) {
|
|
137
137
|
const obj = getObject(arg1);
|
|
138
138
|
const ret = typeof(obj) === 'number' ? obj : undefined;
|
|
139
139
|
getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
|
|
140
140
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
141
141
|
},
|
|
142
|
-
|
|
142
|
+
__wbg___wbindgen_string_get_ae6081df8158aa73: function(arg0, arg1) {
|
|
143
143
|
const obj = getObject(arg1);
|
|
144
144
|
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
145
145
|
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
@@ -147,18 +147,18 @@ function __wbg_get_imports() {
|
|
|
147
147
|
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
148
148
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
149
149
|
},
|
|
150
|
-
|
|
150
|
+
__wbg___wbindgen_throw_bd5a70920abf0236: function(arg0, arg1) {
|
|
151
151
|
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
152
152
|
},
|
|
153
|
-
|
|
153
|
+
__wbg_call_faf6b66fc4667ce6: function() { return handleError(function (arg0, arg1) {
|
|
154
154
|
const ret = getObject(arg0).call(getObject(arg1));
|
|
155
155
|
return addHeapObject(ret);
|
|
156
156
|
}, arguments); },
|
|
157
|
-
|
|
157
|
+
__wbg_codePointAt_7b7b91ae3899dfad: function(arg0, arg1) {
|
|
158
158
|
const ret = getObject(arg0).codePointAt(arg1 >>> 0);
|
|
159
159
|
return addHeapObject(ret);
|
|
160
160
|
},
|
|
161
|
-
|
|
161
|
+
__wbg_done_e0b2820e599cb9f4: function(arg0) {
|
|
162
162
|
const ret = getObject(arg0).done;
|
|
163
163
|
return ret;
|
|
164
164
|
},
|
|
@@ -173,11 +173,11 @@ function __wbg_get_imports() {
|
|
|
173
173
|
wasm.__wbindgen_export4(deferred0_0, deferred0_1, 1);
|
|
174
174
|
}
|
|
175
175
|
},
|
|
176
|
-
|
|
176
|
+
__wbg_get_97a4b9029a97fbd6: function() { return handleError(function (arg0, arg1) {
|
|
177
177
|
const ret = Reflect.get(getObject(arg0), getObject(arg1));
|
|
178
178
|
return addHeapObject(ret);
|
|
179
179
|
}, arguments); },
|
|
180
|
-
|
|
180
|
+
__wbg_get_unchecked_c33f0e513c522d7c: function(arg0, arg1) {
|
|
181
181
|
const ret = getObject(arg0)[arg1 >>> 0];
|
|
182
182
|
return addHeapObject(ret);
|
|
183
183
|
},
|
|
@@ -185,7 +185,7 @@ function __wbg_get_imports() {
|
|
|
185
185
|
const ret = getObject(arg0)[getObject(arg1)];
|
|
186
186
|
return addHeapObject(ret);
|
|
187
187
|
},
|
|
188
|
-
|
|
188
|
+
__wbg_instanceof_ArrayBuffer_046631d47961f5fe: function(arg0) {
|
|
189
189
|
let result;
|
|
190
190
|
try {
|
|
191
191
|
result = getObject(arg0) instanceof ArrayBuffer;
|
|
@@ -195,7 +195,7 @@ function __wbg_get_imports() {
|
|
|
195
195
|
const ret = result;
|
|
196
196
|
return ret;
|
|
197
197
|
},
|
|
198
|
-
|
|
198
|
+
__wbg_instanceof_Object_a99dcb8b396fa196: function(arg0) {
|
|
199
199
|
let result;
|
|
200
200
|
try {
|
|
201
201
|
result = getObject(arg0) instanceof Object;
|
|
@@ -205,7 +205,7 @@ function __wbg_get_imports() {
|
|
|
205
205
|
const ret = result;
|
|
206
206
|
return ret;
|
|
207
207
|
},
|
|
208
|
-
|
|
208
|
+
__wbg_instanceof_Uint8Array_e7d245baab296394: function(arg0) {
|
|
209
209
|
let result;
|
|
210
210
|
try {
|
|
211
211
|
result = getObject(arg0) instanceof Uint8Array;
|
|
@@ -215,87 +215,87 @@ function __wbg_get_imports() {
|
|
|
215
215
|
const ret = result;
|
|
216
216
|
return ret;
|
|
217
217
|
},
|
|
218
|
-
|
|
218
|
+
__wbg_isArray_8dc932f4b6997756: function(arg0) {
|
|
219
219
|
const ret = Array.isArray(getObject(arg0));
|
|
220
220
|
return ret;
|
|
221
221
|
},
|
|
222
|
-
|
|
222
|
+
__wbg_isSafeInteger_db44a36710ec7a10: function(arg0) {
|
|
223
223
|
const ret = Number.isSafeInteger(getObject(arg0));
|
|
224
224
|
return ret;
|
|
225
225
|
},
|
|
226
|
-
|
|
226
|
+
__wbg_iterator_8af67730d17a1376: function() {
|
|
227
227
|
const ret = Symbol.iterator;
|
|
228
228
|
return addHeapObject(ret);
|
|
229
229
|
},
|
|
230
|
-
|
|
230
|
+
__wbg_keys_696ffd3069bfa716: function(arg0) {
|
|
231
231
|
const ret = Object.keys(getObject(arg0));
|
|
232
232
|
return addHeapObject(ret);
|
|
233
233
|
},
|
|
234
|
-
|
|
234
|
+
__wbg_length_090b6aa6235450ba: function(arg0) {
|
|
235
235
|
const ret = getObject(arg0).length;
|
|
236
236
|
return ret;
|
|
237
237
|
},
|
|
238
|
-
|
|
238
|
+
__wbg_length_713cc1160ce7b5b9: function(arg0) {
|
|
239
239
|
const ret = getObject(arg0).length;
|
|
240
240
|
return ret;
|
|
241
241
|
},
|
|
242
|
-
|
|
242
|
+
__wbg_length_8aeeb5332e9096f0: function(arg0) {
|
|
243
243
|
const ret = getObject(arg0).length;
|
|
244
244
|
return ret;
|
|
245
245
|
},
|
|
246
|
-
|
|
247
|
-
const ret = new
|
|
246
|
+
__wbg_new_227d7c05414eb861: function() {
|
|
247
|
+
const ret = new Error();
|
|
248
248
|
return addHeapObject(ret);
|
|
249
249
|
},
|
|
250
|
-
|
|
250
|
+
__wbg_new_4774b8d4db1224e4: function(arg0) {
|
|
251
251
|
const ret = new Uint8Array(getObject(arg0));
|
|
252
252
|
return addHeapObject(ret);
|
|
253
253
|
},
|
|
254
|
-
|
|
255
|
-
const ret = new
|
|
254
|
+
__wbg_new_480195ddf7042529: function() {
|
|
255
|
+
const ret = new Array();
|
|
256
256
|
return addHeapObject(ret);
|
|
257
257
|
},
|
|
258
|
-
|
|
259
|
-
const ret = new
|
|
258
|
+
__wbg_new_d63f24ca072fa278: function() {
|
|
259
|
+
const ret = new Map();
|
|
260
260
|
return addHeapObject(ret);
|
|
261
261
|
},
|
|
262
|
-
|
|
262
|
+
__wbg_new_e4597c3f125a2038: function() {
|
|
263
263
|
const ret = new Object();
|
|
264
264
|
return addHeapObject(ret);
|
|
265
265
|
},
|
|
266
|
-
|
|
266
|
+
__wbg_new_from_slice_2733a138cec5cdcf: function(arg0, arg1) {
|
|
267
267
|
const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1));
|
|
268
268
|
return addHeapObject(ret);
|
|
269
269
|
},
|
|
270
|
-
|
|
271
|
-
const ret = getObject(arg0).next;
|
|
272
|
-
return addHeapObject(ret);
|
|
273
|
-
},
|
|
274
|
-
__wbg_next_e34cfb9df1518d7c: function() { return handleError(function (arg0) {
|
|
270
|
+
__wbg_next_9a5990d0355cdd1a: function() { return handleError(function (arg0) {
|
|
275
271
|
const ret = getObject(arg0).next();
|
|
276
272
|
return addHeapObject(ret);
|
|
277
273
|
}, arguments); },
|
|
278
|
-
|
|
274
|
+
__wbg_next_e75ce91d696d3c0f: function(arg0) {
|
|
275
|
+
const ret = getObject(arg0).next;
|
|
276
|
+
return addHeapObject(ret);
|
|
277
|
+
},
|
|
278
|
+
__wbg_prototypesetcall_7dca54d31cb9d2dc: function(arg0, arg1, arg2) {
|
|
279
279
|
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), getObject(arg2));
|
|
280
280
|
},
|
|
281
|
-
|
|
281
|
+
__wbg_push_bb0def92a641d074: function(arg0, arg1) {
|
|
282
282
|
const ret = getObject(arg0).push(getObject(arg1));
|
|
283
283
|
return ret;
|
|
284
284
|
},
|
|
285
|
-
|
|
286
|
-
getObject(arg0)
|
|
287
|
-
|
|
285
|
+
__wbg_set_05b085c909633819: function() { return handleError(function (arg0, arg1, arg2) {
|
|
286
|
+
const ret = Reflect.set(getObject(arg0), getObject(arg1), getObject(arg2));
|
|
287
|
+
return ret;
|
|
288
|
+
}, arguments); },
|
|
288
289
|
__wbg_set_6be42768c690e380: function(arg0, arg1, arg2) {
|
|
289
290
|
getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
|
|
290
291
|
},
|
|
291
|
-
|
|
292
|
+
__wbg_set_84911e1f7639680c: function(arg0, arg1, arg2) {
|
|
292
293
|
const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
|
|
293
294
|
return addHeapObject(ret);
|
|
294
295
|
},
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
}, arguments); },
|
|
296
|
+
__wbg_set_c78f0ccf7c3f53b7: function(arg0, arg1, arg2) {
|
|
297
|
+
getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
|
|
298
|
+
},
|
|
299
299
|
__wbg_stack_3b0d974bbf31e44f: function(arg0, arg1) {
|
|
300
300
|
const ret = getObject(arg1).stack;
|
|
301
301
|
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
@@ -303,7 +303,7 @@ function __wbg_get_imports() {
|
|
|
303
303
|
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
304
304
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
305
305
|
},
|
|
306
|
-
|
|
306
|
+
__wbg_value_8996dd08e99f9529: function(arg0) {
|
|
307
307
|
const ret = getObject(arg0).value;
|
|
308
308
|
return addHeapObject(ret);
|
|
309
309
|
},
|
|
Binary file
|
package/dist-web/package.json
CHANGED
package/package.json
CHANGED