html-to-markdown-wasm 2.8.0 → 2.8.2
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/README.md +25 -12
- package/dist/html_to_markdown_wasm.d.ts +5 -5
- package/dist/html_to_markdown_wasm_bg.js +108 -108
- package/dist/html_to_markdown_wasm_bg.wasm +0 -0
- package/dist/package.json +1 -1
- package/dist-node/README.md +25 -12
- package/dist-node/html_to_markdown_wasm.d.ts +5 -5
- package/dist-node/html_to_markdown_wasm.js +108 -108
- package/dist-node/html_to_markdown_wasm_bg.wasm +0 -0
- package/dist-node/package.json +1 -1
- package/dist-web/README.md +25 -12
- package/dist-web/html_to_markdown_wasm.d.ts +5 -5
- package/dist-web/html_to_markdown_wasm.js +108 -108
- package/dist-web/html_to_markdown_wasm_bg.wasm +0 -0
- package/dist-web/package.json +1 -1
- package/package.json +1 -1
|
@@ -228,88 +228,90 @@ function getArrayJsValueFromWasm0(ptr, len) {
|
|
|
228
228
|
return result;
|
|
229
229
|
}
|
|
230
230
|
/**
|
|
231
|
-
* @param {Uint8Array} html
|
|
232
231
|
* @param {any} options
|
|
233
|
-
* @returns {
|
|
232
|
+
* @returns {WasmConversionOptionsHandle}
|
|
234
233
|
*/
|
|
235
|
-
export function
|
|
236
|
-
let deferred2_0;
|
|
237
|
-
let deferred2_1;
|
|
234
|
+
export function createConversionOptionsHandle(options) {
|
|
238
235
|
try {
|
|
239
236
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
240
|
-
wasm.
|
|
237
|
+
wasm.createConversionOptionsHandle(retptr, addHeapObject(options));
|
|
241
238
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
242
239
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
243
240
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
var len1 = r1;
|
|
247
|
-
if (r3) {
|
|
248
|
-
ptr1 = 0; len1 = 0;
|
|
249
|
-
throw takeObject(r2);
|
|
241
|
+
if (r2) {
|
|
242
|
+
throw takeObject(r1);
|
|
250
243
|
}
|
|
251
|
-
|
|
252
|
-
deferred2_1 = len1;
|
|
253
|
-
return getStringFromWasm0(ptr1, len1);
|
|
244
|
+
return WasmConversionOptionsHandle.__wrap(r0);
|
|
254
245
|
} finally {
|
|
255
246
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
256
|
-
wasm.__wbindgen_export4(deferred2_0, deferred2_1, 1);
|
|
257
247
|
}
|
|
258
248
|
}
|
|
259
249
|
|
|
250
|
+
function _assertClass(instance, klass) {
|
|
251
|
+
if (!(instance instanceof klass)) {
|
|
252
|
+
throw new Error(`expected instance of ${klass.name}`);
|
|
253
|
+
}
|
|
254
|
+
}
|
|
260
255
|
/**
|
|
261
|
-
* Convert HTML to Markdown
|
|
262
|
-
*
|
|
263
|
-
* # Arguments
|
|
264
|
-
*
|
|
265
|
-
* * `html` - The HTML string to convert
|
|
266
|
-
* * `options` - Optional conversion options (as a JavaScript object)
|
|
267
|
-
*
|
|
268
|
-
* # Example
|
|
269
|
-
*
|
|
270
|
-
* ```javascript
|
|
271
|
-
* import { convert } from 'html-to-markdown-wasm';
|
|
272
|
-
*
|
|
273
|
-
* const html = '<h1>Hello World</h1>';
|
|
274
|
-
* const markdown = convert(html);
|
|
275
|
-
* console.log(markdown); // # Hello World
|
|
276
|
-
* ```
|
|
277
256
|
* @param {string} html
|
|
278
257
|
* @param {any} options
|
|
279
|
-
* @
|
|
258
|
+
* @param {WasmInlineImageConfig | null} [image_config]
|
|
259
|
+
* @returns {WasmHtmlExtraction}
|
|
280
260
|
*/
|
|
281
|
-
export function
|
|
282
|
-
let deferred3_0;
|
|
283
|
-
let deferred3_1;
|
|
261
|
+
export function convertWithInlineImages(html, options, image_config) {
|
|
284
262
|
try {
|
|
285
263
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
286
264
|
const ptr0 = passStringToWasm0(html, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
287
265
|
const len0 = WASM_VECTOR_LEN;
|
|
288
|
-
|
|
266
|
+
let ptr1 = 0;
|
|
267
|
+
if (!isLikeNone(image_config)) {
|
|
268
|
+
_assertClass(image_config, WasmInlineImageConfig);
|
|
269
|
+
ptr1 = image_config.__destroy_into_raw();
|
|
270
|
+
}
|
|
271
|
+
wasm.convertWithInlineImages(retptr, ptr0, len0, addHeapObject(options), ptr1);
|
|
272
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
273
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
274
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
275
|
+
if (r2) {
|
|
276
|
+
throw takeObject(r1);
|
|
277
|
+
}
|
|
278
|
+
return WasmHtmlExtraction.__wrap(r0);
|
|
279
|
+
} finally {
|
|
280
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
/**
|
|
285
|
+
* @param {Uint8Array} html
|
|
286
|
+
* @param {WasmConversionOptionsHandle} handle
|
|
287
|
+
* @returns {string}
|
|
288
|
+
*/
|
|
289
|
+
export function convertBytesWithOptionsHandle(html, handle) {
|
|
290
|
+
let deferred2_0;
|
|
291
|
+
let deferred2_1;
|
|
292
|
+
try {
|
|
293
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
294
|
+
_assertClass(handle, WasmConversionOptionsHandle);
|
|
295
|
+
wasm.convertBytesWithOptionsHandle(retptr, addHeapObject(html), handle.__wbg_ptr);
|
|
289
296
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
290
297
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
291
298
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
292
299
|
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
293
|
-
var
|
|
294
|
-
var
|
|
300
|
+
var ptr1 = r0;
|
|
301
|
+
var len1 = r1;
|
|
295
302
|
if (r3) {
|
|
296
|
-
|
|
303
|
+
ptr1 = 0; len1 = 0;
|
|
297
304
|
throw takeObject(r2);
|
|
298
305
|
}
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
return getStringFromWasm0(
|
|
306
|
+
deferred2_0 = ptr1;
|
|
307
|
+
deferred2_1 = len1;
|
|
308
|
+
return getStringFromWasm0(ptr1, len1);
|
|
302
309
|
} finally {
|
|
303
310
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
304
|
-
wasm.__wbindgen_export4(
|
|
311
|
+
wasm.__wbindgen_export4(deferred2_0, deferred2_1, 1);
|
|
305
312
|
}
|
|
306
313
|
}
|
|
307
314
|
|
|
308
|
-
function _assertClass(instance, klass) {
|
|
309
|
-
if (!(instance instanceof klass)) {
|
|
310
|
-
throw new Error(`expected instance of ${klass.name}`);
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
315
|
/**
|
|
314
316
|
* @param {string} html
|
|
315
317
|
* @param {WasmConversionOptionsHandle} handle
|
|
@@ -343,108 +345,99 @@ export function convertWithOptionsHandle(html, handle) {
|
|
|
343
345
|
}
|
|
344
346
|
}
|
|
345
347
|
|
|
346
|
-
/**
|
|
347
|
-
* Initialize panic hook for better error messages in the browser
|
|
348
|
-
*/
|
|
349
|
-
export function init() {
|
|
350
|
-
wasm.init();
|
|
351
|
-
}
|
|
352
|
-
|
|
353
348
|
/**
|
|
354
349
|
* @param {Uint8Array} html
|
|
355
350
|
* @param {any} options
|
|
356
|
-
* @
|
|
357
|
-
* @returns {WasmHtmlExtraction}
|
|
351
|
+
* @returns {string}
|
|
358
352
|
*/
|
|
359
|
-
export function
|
|
353
|
+
export function convertBytes(html, options) {
|
|
354
|
+
let deferred2_0;
|
|
355
|
+
let deferred2_1;
|
|
360
356
|
try {
|
|
361
357
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
362
|
-
|
|
363
|
-
if (!isLikeNone(image_config)) {
|
|
364
|
-
_assertClass(image_config, WasmInlineImageConfig);
|
|
365
|
-
ptr0 = image_config.__destroy_into_raw();
|
|
366
|
-
}
|
|
367
|
-
wasm.convertBytesWithInlineImages(retptr, addHeapObject(html), addHeapObject(options), ptr0);
|
|
358
|
+
wasm.convertBytes(retptr, addHeapObject(html), addHeapObject(options));
|
|
368
359
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
369
360
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
370
361
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
371
|
-
|
|
372
|
-
|
|
362
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
363
|
+
var ptr1 = r0;
|
|
364
|
+
var len1 = r1;
|
|
365
|
+
if (r3) {
|
|
366
|
+
ptr1 = 0; len1 = 0;
|
|
367
|
+
throw takeObject(r2);
|
|
373
368
|
}
|
|
374
|
-
|
|
369
|
+
deferred2_0 = ptr1;
|
|
370
|
+
deferred2_1 = len1;
|
|
371
|
+
return getStringFromWasm0(ptr1, len1);
|
|
375
372
|
} finally {
|
|
376
373
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
374
|
+
wasm.__wbindgen_export4(deferred2_0, deferred2_1, 1);
|
|
377
375
|
}
|
|
378
376
|
}
|
|
379
377
|
|
|
380
378
|
/**
|
|
379
|
+
* Convert HTML to Markdown
|
|
380
|
+
*
|
|
381
|
+
* # Arguments
|
|
382
|
+
*
|
|
383
|
+
* * `html` - The HTML string to convert
|
|
384
|
+
* * `options` - Optional conversion options (as a JavaScript object)
|
|
385
|
+
*
|
|
386
|
+
* # Example
|
|
387
|
+
*
|
|
388
|
+
* ```javascript
|
|
389
|
+
* import { convert } from 'html-to-markdown-wasm';
|
|
390
|
+
*
|
|
391
|
+
* const html = '<h1>Hello World</h1>';
|
|
392
|
+
* const markdown = convert(html);
|
|
393
|
+
* console.log(markdown); // # Hello World
|
|
394
|
+
* ```
|
|
395
|
+
* @param {string} html
|
|
381
396
|
* @param {any} options
|
|
382
|
-
* @returns {WasmConversionOptionsHandle}
|
|
383
|
-
*/
|
|
384
|
-
export function createConversionOptionsHandle(options) {
|
|
385
|
-
try {
|
|
386
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
387
|
-
wasm.createConversionOptionsHandle(retptr, addHeapObject(options));
|
|
388
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
389
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
390
|
-
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
391
|
-
if (r2) {
|
|
392
|
-
throw takeObject(r1);
|
|
393
|
-
}
|
|
394
|
-
return WasmConversionOptionsHandle.__wrap(r0);
|
|
395
|
-
} finally {
|
|
396
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
397
|
-
}
|
|
398
|
-
}
|
|
399
|
-
|
|
400
|
-
/**
|
|
401
|
-
* @param {Uint8Array} html
|
|
402
|
-
* @param {WasmConversionOptionsHandle} handle
|
|
403
397
|
* @returns {string}
|
|
404
398
|
*/
|
|
405
|
-
export function
|
|
406
|
-
let
|
|
407
|
-
let
|
|
399
|
+
export function convert(html, options) {
|
|
400
|
+
let deferred3_0;
|
|
401
|
+
let deferred3_1;
|
|
408
402
|
try {
|
|
409
403
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
410
|
-
|
|
411
|
-
|
|
404
|
+
const ptr0 = passStringToWasm0(html, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
405
|
+
const len0 = WASM_VECTOR_LEN;
|
|
406
|
+
wasm.convert(retptr, ptr0, len0, addHeapObject(options));
|
|
412
407
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
413
408
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
414
409
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
415
410
|
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
416
|
-
var
|
|
417
|
-
var
|
|
411
|
+
var ptr2 = r0;
|
|
412
|
+
var len2 = r1;
|
|
418
413
|
if (r3) {
|
|
419
|
-
|
|
414
|
+
ptr2 = 0; len2 = 0;
|
|
420
415
|
throw takeObject(r2);
|
|
421
416
|
}
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
return getStringFromWasm0(
|
|
417
|
+
deferred3_0 = ptr2;
|
|
418
|
+
deferred3_1 = len2;
|
|
419
|
+
return getStringFromWasm0(ptr2, len2);
|
|
425
420
|
} finally {
|
|
426
421
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
427
|
-
wasm.__wbindgen_export4(
|
|
422
|
+
wasm.__wbindgen_export4(deferred3_0, deferred3_1, 1);
|
|
428
423
|
}
|
|
429
424
|
}
|
|
430
425
|
|
|
431
426
|
/**
|
|
432
|
-
* @param {
|
|
427
|
+
* @param {Uint8Array} html
|
|
433
428
|
* @param {any} options
|
|
434
429
|
* @param {WasmInlineImageConfig | null} [image_config]
|
|
435
430
|
* @returns {WasmHtmlExtraction}
|
|
436
431
|
*/
|
|
437
|
-
export function
|
|
432
|
+
export function convertBytesWithInlineImages(html, options, image_config) {
|
|
438
433
|
try {
|
|
439
434
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
440
|
-
|
|
441
|
-
const len0 = WASM_VECTOR_LEN;
|
|
442
|
-
let ptr1 = 0;
|
|
435
|
+
let ptr0 = 0;
|
|
443
436
|
if (!isLikeNone(image_config)) {
|
|
444
437
|
_assertClass(image_config, WasmInlineImageConfig);
|
|
445
|
-
|
|
438
|
+
ptr0 = image_config.__destroy_into_raw();
|
|
446
439
|
}
|
|
447
|
-
wasm.
|
|
440
|
+
wasm.convertBytesWithInlineImages(retptr, addHeapObject(html), addHeapObject(options), ptr0);
|
|
448
441
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
449
442
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
450
443
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -457,6 +450,13 @@ export function convertWithInlineImages(html, options, image_config) {
|
|
|
457
450
|
}
|
|
458
451
|
}
|
|
459
452
|
|
|
453
|
+
/**
|
|
454
|
+
* Initialize panic hook for better error messages in the browser
|
|
455
|
+
*/
|
|
456
|
+
export function init() {
|
|
457
|
+
wasm.init();
|
|
458
|
+
}
|
|
459
|
+
|
|
460
460
|
const WasmConversionOptionsHandleFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
461
461
|
? { register: () => {}, unregister: () => {} }
|
|
462
462
|
: new FinalizationRegistry(ptr => wasm.__wbg_wasmconversionoptionshandle_free(ptr >>> 0, 1));
|
|
Binary file
|
package/dist-web/package.json
CHANGED
package/package.json
CHANGED