html-to-markdown-wasm 2.8.0 → 2.8.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.
@@ -1,5 +1,9 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
+ /**
4
+ * Initialize panic hook for better error messages in the browser
5
+ */
6
+ export function init(): void;
3
7
  export function convertBytes(html: Uint8Array, options: any): string;
4
8
  /**
5
9
  * Convert HTML to Markdown
@@ -20,15 +24,11 @@ export function convertBytes(html: Uint8Array, options: any): string;
20
24
  * ```
21
25
  */
22
26
  export function convert(html: string, options: any): string;
23
- export function convertWithOptionsHandle(html: string, handle: WasmConversionOptionsHandle): string;
24
- /**
25
- * Initialize panic hook for better error messages in the browser
26
- */
27
- export function init(): void;
28
- export function convertBytesWithInlineImages(html: Uint8Array, options: any, image_config?: WasmInlineImageConfig | null): WasmHtmlExtraction;
29
- export function createConversionOptionsHandle(options: any): WasmConversionOptionsHandle;
30
27
  export function convertBytesWithOptionsHandle(html: Uint8Array, handle: WasmConversionOptionsHandle): string;
28
+ export function createConversionOptionsHandle(options: any): WasmConversionOptionsHandle;
31
29
  export function convertWithInlineImages(html: string, options: any, image_config?: WasmInlineImageConfig | null): WasmHtmlExtraction;
30
+ export function convertWithOptionsHandle(html: string, handle: WasmConversionOptionsHandle): string;
31
+ export function convertBytesWithInlineImages(html: Uint8Array, options: any, image_config?: WasmInlineImageConfig | null): WasmHtmlExtraction;
32
32
  export class WasmConversionOptionsHandle {
33
33
  free(): void;
34
34
  [Symbol.dispose](): void;
@@ -231,6 +231,13 @@ function getArrayJsValueFromWasm0(ptr, len) {
231
231
  }
232
232
  return result;
233
233
  }
234
+ /**
235
+ * Initialize panic hook for better error messages in the browser
236
+ */
237
+ export function init() {
238
+ wasm.init();
239
+ }
240
+
234
241
  /**
235
242
  * @param {Uint8Array} html
236
243
  * @param {any} options
@@ -315,140 +322,133 @@ function _assertClass(instance, klass) {
315
322
  }
316
323
  }
317
324
  /**
318
- * @param {string} html
325
+ * @param {Uint8Array} html
319
326
  * @param {WasmConversionOptionsHandle} handle
320
327
  * @returns {string}
321
328
  */
322
- export function convertWithOptionsHandle(html, handle) {
323
- let deferred3_0;
324
- let deferred3_1;
329
+ export function convertBytesWithOptionsHandle(html, handle) {
330
+ let deferred2_0;
331
+ let deferred2_1;
325
332
  try {
326
333
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
327
- const ptr0 = passStringToWasm0(html, wasm.__wbindgen_export, wasm.__wbindgen_export2);
328
- const len0 = WASM_VECTOR_LEN;
329
334
  _assertClass(handle, WasmConversionOptionsHandle);
330
- wasm.convertWithOptionsHandle(retptr, ptr0, len0, handle.__wbg_ptr);
335
+ wasm.convertBytesWithOptionsHandle(retptr, addHeapObject(html), handle.__wbg_ptr);
331
336
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
332
337
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
333
338
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
334
339
  var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
335
- var ptr2 = r0;
336
- var len2 = r1;
340
+ var ptr1 = r0;
341
+ var len1 = r1;
337
342
  if (r3) {
338
- ptr2 = 0; len2 = 0;
343
+ ptr1 = 0; len1 = 0;
339
344
  throw takeObject(r2);
340
345
  }
341
- deferred3_0 = ptr2;
342
- deferred3_1 = len2;
343
- return getStringFromWasm0(ptr2, len2);
346
+ deferred2_0 = ptr1;
347
+ deferred2_1 = len1;
348
+ return getStringFromWasm0(ptr1, len1);
344
349
  } finally {
345
350
  wasm.__wbindgen_add_to_stack_pointer(16);
346
- wasm.__wbindgen_export4(deferred3_0, deferred3_1, 1);
351
+ wasm.__wbindgen_export4(deferred2_0, deferred2_1, 1);
347
352
  }
348
353
  }
349
354
 
350
355
  /**
351
- * Initialize panic hook for better error messages in the browser
352
- */
353
- export function init() {
354
- wasm.init();
355
- }
356
-
357
- /**
358
- * @param {Uint8Array} html
359
356
  * @param {any} options
360
- * @param {WasmInlineImageConfig | null} [image_config]
361
- * @returns {WasmHtmlExtraction}
357
+ * @returns {WasmConversionOptionsHandle}
362
358
  */
363
- export function convertBytesWithInlineImages(html, options, image_config) {
359
+ export function createConversionOptionsHandle(options) {
364
360
  try {
365
361
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
366
- let ptr0 = 0;
367
- if (!isLikeNone(image_config)) {
368
- _assertClass(image_config, WasmInlineImageConfig);
369
- ptr0 = image_config.__destroy_into_raw();
370
- }
371
- wasm.convertBytesWithInlineImages(retptr, addHeapObject(html), addHeapObject(options), ptr0);
362
+ wasm.createConversionOptionsHandle(retptr, addHeapObject(options));
372
363
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
373
364
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
374
365
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
375
366
  if (r2) {
376
367
  throw takeObject(r1);
377
368
  }
378
- return WasmHtmlExtraction.__wrap(r0);
369
+ return WasmConversionOptionsHandle.__wrap(r0);
379
370
  } finally {
380
371
  wasm.__wbindgen_add_to_stack_pointer(16);
381
372
  }
382
373
  }
383
374
 
384
375
  /**
376
+ * @param {string} html
385
377
  * @param {any} options
386
- * @returns {WasmConversionOptionsHandle}
378
+ * @param {WasmInlineImageConfig | null} [image_config]
379
+ * @returns {WasmHtmlExtraction}
387
380
  */
388
- export function createConversionOptionsHandle(options) {
381
+ export function convertWithInlineImages(html, options, image_config) {
389
382
  try {
390
383
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
391
- wasm.createConversionOptionsHandle(retptr, addHeapObject(options));
384
+ const ptr0 = passStringToWasm0(html, wasm.__wbindgen_export, wasm.__wbindgen_export2);
385
+ const len0 = WASM_VECTOR_LEN;
386
+ let ptr1 = 0;
387
+ if (!isLikeNone(image_config)) {
388
+ _assertClass(image_config, WasmInlineImageConfig);
389
+ ptr1 = image_config.__destroy_into_raw();
390
+ }
391
+ wasm.convertWithInlineImages(retptr, ptr0, len0, addHeapObject(options), ptr1);
392
392
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
393
393
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
394
394
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
395
395
  if (r2) {
396
396
  throw takeObject(r1);
397
397
  }
398
- return WasmConversionOptionsHandle.__wrap(r0);
398
+ return WasmHtmlExtraction.__wrap(r0);
399
399
  } finally {
400
400
  wasm.__wbindgen_add_to_stack_pointer(16);
401
401
  }
402
402
  }
403
403
 
404
404
  /**
405
- * @param {Uint8Array} html
405
+ * @param {string} html
406
406
  * @param {WasmConversionOptionsHandle} handle
407
407
  * @returns {string}
408
408
  */
409
- export function convertBytesWithOptionsHandle(html, handle) {
410
- let deferred2_0;
411
- let deferred2_1;
409
+ export function convertWithOptionsHandle(html, handle) {
410
+ let deferred3_0;
411
+ let deferred3_1;
412
412
  try {
413
413
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
414
+ const ptr0 = passStringToWasm0(html, wasm.__wbindgen_export, wasm.__wbindgen_export2);
415
+ const len0 = WASM_VECTOR_LEN;
414
416
  _assertClass(handle, WasmConversionOptionsHandle);
415
- wasm.convertBytesWithOptionsHandle(retptr, addHeapObject(html), handle.__wbg_ptr);
417
+ wasm.convertWithOptionsHandle(retptr, ptr0, len0, handle.__wbg_ptr);
416
418
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
417
419
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
418
420
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
419
421
  var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
420
- var ptr1 = r0;
421
- var len1 = r1;
422
+ var ptr2 = r0;
423
+ var len2 = r1;
422
424
  if (r3) {
423
- ptr1 = 0; len1 = 0;
425
+ ptr2 = 0; len2 = 0;
424
426
  throw takeObject(r2);
425
427
  }
426
- deferred2_0 = ptr1;
427
- deferred2_1 = len1;
428
- return getStringFromWasm0(ptr1, len1);
428
+ deferred3_0 = ptr2;
429
+ deferred3_1 = len2;
430
+ return getStringFromWasm0(ptr2, len2);
429
431
  } finally {
430
432
  wasm.__wbindgen_add_to_stack_pointer(16);
431
- wasm.__wbindgen_export4(deferred2_0, deferred2_1, 1);
433
+ wasm.__wbindgen_export4(deferred3_0, deferred3_1, 1);
432
434
  }
433
435
  }
434
436
 
435
437
  /**
436
- * @param {string} html
438
+ * @param {Uint8Array} html
437
439
  * @param {any} options
438
440
  * @param {WasmInlineImageConfig | null} [image_config]
439
441
  * @returns {WasmHtmlExtraction}
440
442
  */
441
- export function convertWithInlineImages(html, options, image_config) {
443
+ export function convertBytesWithInlineImages(html, options, image_config) {
442
444
  try {
443
445
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
444
- const ptr0 = passStringToWasm0(html, wasm.__wbindgen_export, wasm.__wbindgen_export2);
445
- const len0 = WASM_VECTOR_LEN;
446
- let ptr1 = 0;
446
+ let ptr0 = 0;
447
447
  if (!isLikeNone(image_config)) {
448
448
  _assertClass(image_config, WasmInlineImageConfig);
449
- ptr1 = image_config.__destroy_into_raw();
449
+ ptr0 = image_config.__destroy_into_raw();
450
450
  }
451
- wasm.convertWithInlineImages(retptr, ptr0, len0, addHeapObject(options), ptr1);
451
+ wasm.convertBytesWithInlineImages(retptr, addHeapObject(html), addHeapObject(options), ptr0);
452
452
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
453
453
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
454
454
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
Binary file
package/dist/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "collaborators": [
5
5
  "Na'aman Hirschfeld <nhirschfeld@gmail.com>"
6
6
  ],
7
- "version": "2.8.0",
7
+ "version": "2.8.1",
8
8
  "license": "MIT",
9
9
  "repository": {
10
10
  "type": "git",
@@ -1,5 +1,9 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
+ /**
4
+ * Initialize panic hook for better error messages in the browser
5
+ */
6
+ export function init(): void;
3
7
  export function convertBytes(html: Uint8Array, options: any): string;
4
8
  /**
5
9
  * Convert HTML to Markdown
@@ -20,15 +24,11 @@ export function convertBytes(html: Uint8Array, options: any): string;
20
24
  * ```
21
25
  */
22
26
  export function convert(html: string, options: any): string;
23
- export function convertWithOptionsHandle(html: string, handle: WasmConversionOptionsHandle): string;
24
- /**
25
- * Initialize panic hook for better error messages in the browser
26
- */
27
- export function init(): void;
28
- export function convertBytesWithInlineImages(html: Uint8Array, options: any, image_config?: WasmInlineImageConfig | null): WasmHtmlExtraction;
29
- export function createConversionOptionsHandle(options: any): WasmConversionOptionsHandle;
30
27
  export function convertBytesWithOptionsHandle(html: Uint8Array, handle: WasmConversionOptionsHandle): string;
28
+ export function createConversionOptionsHandle(options: any): WasmConversionOptionsHandle;
31
29
  export function convertWithInlineImages(html: string, options: any, image_config?: WasmInlineImageConfig | null): WasmHtmlExtraction;
30
+ export function convertWithOptionsHandle(html: string, handle: WasmConversionOptionsHandle): string;
31
+ export function convertBytesWithInlineImages(html: Uint8Array, options: any, image_config?: WasmInlineImageConfig | null): WasmHtmlExtraction;
32
32
  export class WasmConversionOptionsHandle {
33
33
  free(): void;
34
34
  [Symbol.dispose](): void;
@@ -221,6 +221,13 @@ function getArrayJsValueFromWasm0(ptr, len) {
221
221
  }
222
222
  return result;
223
223
  }
224
+ /**
225
+ * Initialize panic hook for better error messages in the browser
226
+ */
227
+ exports.init = function() {
228
+ wasm.init();
229
+ };
230
+
224
231
  /**
225
232
  * @param {Uint8Array} html
226
233
  * @param {any} options
@@ -305,140 +312,133 @@ function _assertClass(instance, klass) {
305
312
  }
306
313
  }
307
314
  /**
308
- * @param {string} html
315
+ * @param {Uint8Array} html
309
316
  * @param {WasmConversionOptionsHandle} handle
310
317
  * @returns {string}
311
318
  */
312
- exports.convertWithOptionsHandle = function(html, handle) {
313
- let deferred3_0;
314
- let deferred3_1;
319
+ exports.convertBytesWithOptionsHandle = function(html, handle) {
320
+ let deferred2_0;
321
+ let deferred2_1;
315
322
  try {
316
323
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
317
- const ptr0 = passStringToWasm0(html, wasm.__wbindgen_export, wasm.__wbindgen_export2);
318
- const len0 = WASM_VECTOR_LEN;
319
324
  _assertClass(handle, WasmConversionOptionsHandle);
320
- wasm.convertWithOptionsHandle(retptr, ptr0, len0, handle.__wbg_ptr);
325
+ wasm.convertBytesWithOptionsHandle(retptr, addHeapObject(html), handle.__wbg_ptr);
321
326
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
322
327
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
323
328
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
324
329
  var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
325
- var ptr2 = r0;
326
- var len2 = r1;
330
+ var ptr1 = r0;
331
+ var len1 = r1;
327
332
  if (r3) {
328
- ptr2 = 0; len2 = 0;
333
+ ptr1 = 0; len1 = 0;
329
334
  throw takeObject(r2);
330
335
  }
331
- deferred3_0 = ptr2;
332
- deferred3_1 = len2;
333
- return getStringFromWasm0(ptr2, len2);
336
+ deferred2_0 = ptr1;
337
+ deferred2_1 = len1;
338
+ return getStringFromWasm0(ptr1, len1);
334
339
  } finally {
335
340
  wasm.__wbindgen_add_to_stack_pointer(16);
336
- wasm.__wbindgen_export4(deferred3_0, deferred3_1, 1);
341
+ wasm.__wbindgen_export4(deferred2_0, deferred2_1, 1);
337
342
  }
338
343
  };
339
344
 
340
345
  /**
341
- * Initialize panic hook for better error messages in the browser
342
- */
343
- exports.init = function() {
344
- wasm.init();
345
- };
346
-
347
- /**
348
- * @param {Uint8Array} html
349
346
  * @param {any} options
350
- * @param {WasmInlineImageConfig | null} [image_config]
351
- * @returns {WasmHtmlExtraction}
347
+ * @returns {WasmConversionOptionsHandle}
352
348
  */
353
- exports.convertBytesWithInlineImages = function(html, options, image_config) {
349
+ exports.createConversionOptionsHandle = function(options) {
354
350
  try {
355
351
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
356
- let ptr0 = 0;
357
- if (!isLikeNone(image_config)) {
358
- _assertClass(image_config, WasmInlineImageConfig);
359
- ptr0 = image_config.__destroy_into_raw();
360
- }
361
- wasm.convertBytesWithInlineImages(retptr, addHeapObject(html), addHeapObject(options), ptr0);
352
+ wasm.createConversionOptionsHandle(retptr, addHeapObject(options));
362
353
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
363
354
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
364
355
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
365
356
  if (r2) {
366
357
  throw takeObject(r1);
367
358
  }
368
- return WasmHtmlExtraction.__wrap(r0);
359
+ return WasmConversionOptionsHandle.__wrap(r0);
369
360
  } finally {
370
361
  wasm.__wbindgen_add_to_stack_pointer(16);
371
362
  }
372
363
  };
373
364
 
374
365
  /**
366
+ * @param {string} html
375
367
  * @param {any} options
376
- * @returns {WasmConversionOptionsHandle}
368
+ * @param {WasmInlineImageConfig | null} [image_config]
369
+ * @returns {WasmHtmlExtraction}
377
370
  */
378
- exports.createConversionOptionsHandle = function(options) {
371
+ exports.convertWithInlineImages = function(html, options, image_config) {
379
372
  try {
380
373
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
381
- wasm.createConversionOptionsHandle(retptr, addHeapObject(options));
374
+ const ptr0 = passStringToWasm0(html, wasm.__wbindgen_export, wasm.__wbindgen_export2);
375
+ const len0 = WASM_VECTOR_LEN;
376
+ let ptr1 = 0;
377
+ if (!isLikeNone(image_config)) {
378
+ _assertClass(image_config, WasmInlineImageConfig);
379
+ ptr1 = image_config.__destroy_into_raw();
380
+ }
381
+ wasm.convertWithInlineImages(retptr, ptr0, len0, addHeapObject(options), ptr1);
382
382
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
383
383
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
384
384
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
385
385
  if (r2) {
386
386
  throw takeObject(r1);
387
387
  }
388
- return WasmConversionOptionsHandle.__wrap(r0);
388
+ return WasmHtmlExtraction.__wrap(r0);
389
389
  } finally {
390
390
  wasm.__wbindgen_add_to_stack_pointer(16);
391
391
  }
392
392
  };
393
393
 
394
394
  /**
395
- * @param {Uint8Array} html
395
+ * @param {string} html
396
396
  * @param {WasmConversionOptionsHandle} handle
397
397
  * @returns {string}
398
398
  */
399
- exports.convertBytesWithOptionsHandle = function(html, handle) {
400
- let deferred2_0;
401
- let deferred2_1;
399
+ exports.convertWithOptionsHandle = function(html, handle) {
400
+ let deferred3_0;
401
+ let deferred3_1;
402
402
  try {
403
403
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
404
+ const ptr0 = passStringToWasm0(html, wasm.__wbindgen_export, wasm.__wbindgen_export2);
405
+ const len0 = WASM_VECTOR_LEN;
404
406
  _assertClass(handle, WasmConversionOptionsHandle);
405
- wasm.convertBytesWithOptionsHandle(retptr, addHeapObject(html), handle.__wbg_ptr);
407
+ wasm.convertWithOptionsHandle(retptr, ptr0, len0, handle.__wbg_ptr);
406
408
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
407
409
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
408
410
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
409
411
  var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
410
- var ptr1 = r0;
411
- var len1 = r1;
412
+ var ptr2 = r0;
413
+ var len2 = r1;
412
414
  if (r3) {
413
- ptr1 = 0; len1 = 0;
415
+ ptr2 = 0; len2 = 0;
414
416
  throw takeObject(r2);
415
417
  }
416
- deferred2_0 = ptr1;
417
- deferred2_1 = len1;
418
- return getStringFromWasm0(ptr1, len1);
418
+ deferred3_0 = ptr2;
419
+ deferred3_1 = len2;
420
+ return getStringFromWasm0(ptr2, len2);
419
421
  } finally {
420
422
  wasm.__wbindgen_add_to_stack_pointer(16);
421
- wasm.__wbindgen_export4(deferred2_0, deferred2_1, 1);
423
+ wasm.__wbindgen_export4(deferred3_0, deferred3_1, 1);
422
424
  }
423
425
  };
424
426
 
425
427
  /**
426
- * @param {string} html
428
+ * @param {Uint8Array} html
427
429
  * @param {any} options
428
430
  * @param {WasmInlineImageConfig | null} [image_config]
429
431
  * @returns {WasmHtmlExtraction}
430
432
  */
431
- exports.convertWithInlineImages = function(html, options, image_config) {
433
+ exports.convertBytesWithInlineImages = function(html, options, image_config) {
432
434
  try {
433
435
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
434
- const ptr0 = passStringToWasm0(html, wasm.__wbindgen_export, wasm.__wbindgen_export2);
435
- const len0 = WASM_VECTOR_LEN;
436
- let ptr1 = 0;
436
+ let ptr0 = 0;
437
437
  if (!isLikeNone(image_config)) {
438
438
  _assertClass(image_config, WasmInlineImageConfig);
439
- ptr1 = image_config.__destroy_into_raw();
439
+ ptr0 = image_config.__destroy_into_raw();
440
440
  }
441
- wasm.convertWithInlineImages(retptr, ptr0, len0, addHeapObject(options), ptr1);
441
+ wasm.convertBytesWithInlineImages(retptr, addHeapObject(html), addHeapObject(options), ptr0);
442
442
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
443
443
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
444
444
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -3,7 +3,7 @@
3
3
  "collaborators": [
4
4
  "Na'aman Hirschfeld <nhirschfeld@gmail.com>"
5
5
  ],
6
- "version": "2.8.0",
6
+ "version": "2.8.1",
7
7
  "license": "MIT",
8
8
  "repository": {
9
9
  "type": "git",
@@ -1,5 +1,9 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
+ /**
4
+ * Initialize panic hook for better error messages in the browser
5
+ */
6
+ export function init(): void;
3
7
  export function convertBytes(html: Uint8Array, options: any): string;
4
8
  /**
5
9
  * Convert HTML to Markdown
@@ -20,15 +24,11 @@ export function convertBytes(html: Uint8Array, options: any): string;
20
24
  * ```
21
25
  */
22
26
  export function convert(html: string, options: any): string;
23
- export function convertWithOptionsHandle(html: string, handle: WasmConversionOptionsHandle): string;
24
- /**
25
- * Initialize panic hook for better error messages in the browser
26
- */
27
- export function init(): void;
28
- export function convertBytesWithInlineImages(html: Uint8Array, options: any, image_config?: WasmInlineImageConfig | null): WasmHtmlExtraction;
29
- export function createConversionOptionsHandle(options: any): WasmConversionOptionsHandle;
30
27
  export function convertBytesWithOptionsHandle(html: Uint8Array, handle: WasmConversionOptionsHandle): string;
28
+ export function createConversionOptionsHandle(options: any): WasmConversionOptionsHandle;
31
29
  export function convertWithInlineImages(html: string, options: any, image_config?: WasmInlineImageConfig | null): WasmHtmlExtraction;
30
+ export function convertWithOptionsHandle(html: string, handle: WasmConversionOptionsHandle): string;
31
+ export function convertBytesWithInlineImages(html: Uint8Array, options: any, image_config?: WasmInlineImageConfig | null): WasmHtmlExtraction;
32
32
  export class WasmConversionOptionsHandle {
33
33
  free(): void;
34
34
  [Symbol.dispose](): void;
@@ -227,6 +227,13 @@ function getArrayJsValueFromWasm0(ptr, len) {
227
227
  }
228
228
  return result;
229
229
  }
230
+ /**
231
+ * Initialize panic hook for better error messages in the browser
232
+ */
233
+ export function init() {
234
+ wasm.init();
235
+ }
236
+
230
237
  /**
231
238
  * @param {Uint8Array} html
232
239
  * @param {any} options
@@ -311,140 +318,133 @@ function _assertClass(instance, klass) {
311
318
  }
312
319
  }
313
320
  /**
314
- * @param {string} html
321
+ * @param {Uint8Array} html
315
322
  * @param {WasmConversionOptionsHandle} handle
316
323
  * @returns {string}
317
324
  */
318
- export function convertWithOptionsHandle(html, handle) {
319
- let deferred3_0;
320
- let deferred3_1;
325
+ export function convertBytesWithOptionsHandle(html, handle) {
326
+ let deferred2_0;
327
+ let deferred2_1;
321
328
  try {
322
329
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
323
- const ptr0 = passStringToWasm0(html, wasm.__wbindgen_export, wasm.__wbindgen_export2);
324
- const len0 = WASM_VECTOR_LEN;
325
330
  _assertClass(handle, WasmConversionOptionsHandle);
326
- wasm.convertWithOptionsHandle(retptr, ptr0, len0, handle.__wbg_ptr);
331
+ wasm.convertBytesWithOptionsHandle(retptr, addHeapObject(html), handle.__wbg_ptr);
327
332
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
328
333
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
329
334
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
330
335
  var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
331
- var ptr2 = r0;
332
- var len2 = r1;
336
+ var ptr1 = r0;
337
+ var len1 = r1;
333
338
  if (r3) {
334
- ptr2 = 0; len2 = 0;
339
+ ptr1 = 0; len1 = 0;
335
340
  throw takeObject(r2);
336
341
  }
337
- deferred3_0 = ptr2;
338
- deferred3_1 = len2;
339
- return getStringFromWasm0(ptr2, len2);
342
+ deferred2_0 = ptr1;
343
+ deferred2_1 = len1;
344
+ return getStringFromWasm0(ptr1, len1);
340
345
  } finally {
341
346
  wasm.__wbindgen_add_to_stack_pointer(16);
342
- wasm.__wbindgen_export4(deferred3_0, deferred3_1, 1);
347
+ wasm.__wbindgen_export4(deferred2_0, deferred2_1, 1);
343
348
  }
344
349
  }
345
350
 
346
351
  /**
347
- * Initialize panic hook for better error messages in the browser
348
- */
349
- export function init() {
350
- wasm.init();
351
- }
352
-
353
- /**
354
- * @param {Uint8Array} html
355
352
  * @param {any} options
356
- * @param {WasmInlineImageConfig | null} [image_config]
357
- * @returns {WasmHtmlExtraction}
353
+ * @returns {WasmConversionOptionsHandle}
358
354
  */
359
- export function convertBytesWithInlineImages(html, options, image_config) {
355
+ export function createConversionOptionsHandle(options) {
360
356
  try {
361
357
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
362
- let ptr0 = 0;
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.createConversionOptionsHandle(retptr, 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
362
  if (r2) {
372
363
  throw takeObject(r1);
373
364
  }
374
- return WasmHtmlExtraction.__wrap(r0);
365
+ return WasmConversionOptionsHandle.__wrap(r0);
375
366
  } finally {
376
367
  wasm.__wbindgen_add_to_stack_pointer(16);
377
368
  }
378
369
  }
379
370
 
380
371
  /**
372
+ * @param {string} html
381
373
  * @param {any} options
382
- * @returns {WasmConversionOptionsHandle}
374
+ * @param {WasmInlineImageConfig | null} [image_config]
375
+ * @returns {WasmHtmlExtraction}
383
376
  */
384
- export function createConversionOptionsHandle(options) {
377
+ export function convertWithInlineImages(html, options, image_config) {
385
378
  try {
386
379
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
387
- wasm.createConversionOptionsHandle(retptr, addHeapObject(options));
380
+ const ptr0 = passStringToWasm0(html, wasm.__wbindgen_export, wasm.__wbindgen_export2);
381
+ const len0 = WASM_VECTOR_LEN;
382
+ let ptr1 = 0;
383
+ if (!isLikeNone(image_config)) {
384
+ _assertClass(image_config, WasmInlineImageConfig);
385
+ ptr1 = image_config.__destroy_into_raw();
386
+ }
387
+ wasm.convertWithInlineImages(retptr, ptr0, len0, addHeapObject(options), ptr1);
388
388
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
389
389
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
390
390
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
391
391
  if (r2) {
392
392
  throw takeObject(r1);
393
393
  }
394
- return WasmConversionOptionsHandle.__wrap(r0);
394
+ return WasmHtmlExtraction.__wrap(r0);
395
395
  } finally {
396
396
  wasm.__wbindgen_add_to_stack_pointer(16);
397
397
  }
398
398
  }
399
399
 
400
400
  /**
401
- * @param {Uint8Array} html
401
+ * @param {string} html
402
402
  * @param {WasmConversionOptionsHandle} handle
403
403
  * @returns {string}
404
404
  */
405
- export function convertBytesWithOptionsHandle(html, handle) {
406
- let deferred2_0;
407
- let deferred2_1;
405
+ export function convertWithOptionsHandle(html, handle) {
406
+ let deferred3_0;
407
+ let deferred3_1;
408
408
  try {
409
409
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
410
+ const ptr0 = passStringToWasm0(html, wasm.__wbindgen_export, wasm.__wbindgen_export2);
411
+ const len0 = WASM_VECTOR_LEN;
410
412
  _assertClass(handle, WasmConversionOptionsHandle);
411
- wasm.convertBytesWithOptionsHandle(retptr, addHeapObject(html), handle.__wbg_ptr);
413
+ wasm.convertWithOptionsHandle(retptr, ptr0, len0, handle.__wbg_ptr);
412
414
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
413
415
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
414
416
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
415
417
  var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
416
- var ptr1 = r0;
417
- var len1 = r1;
418
+ var ptr2 = r0;
419
+ var len2 = r1;
418
420
  if (r3) {
419
- ptr1 = 0; len1 = 0;
421
+ ptr2 = 0; len2 = 0;
420
422
  throw takeObject(r2);
421
423
  }
422
- deferred2_0 = ptr1;
423
- deferred2_1 = len1;
424
- return getStringFromWasm0(ptr1, len1);
424
+ deferred3_0 = ptr2;
425
+ deferred3_1 = len2;
426
+ return getStringFromWasm0(ptr2, len2);
425
427
  } finally {
426
428
  wasm.__wbindgen_add_to_stack_pointer(16);
427
- wasm.__wbindgen_export4(deferred2_0, deferred2_1, 1);
429
+ wasm.__wbindgen_export4(deferred3_0, deferred3_1, 1);
428
430
  }
429
431
  }
430
432
 
431
433
  /**
432
- * @param {string} html
434
+ * @param {Uint8Array} html
433
435
  * @param {any} options
434
436
  * @param {WasmInlineImageConfig | null} [image_config]
435
437
  * @returns {WasmHtmlExtraction}
436
438
  */
437
- export function convertWithInlineImages(html, options, image_config) {
439
+ export function convertBytesWithInlineImages(html, options, image_config) {
438
440
  try {
439
441
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
440
- const ptr0 = passStringToWasm0(html, wasm.__wbindgen_export, wasm.__wbindgen_export2);
441
- const len0 = WASM_VECTOR_LEN;
442
- let ptr1 = 0;
442
+ let ptr0 = 0;
443
443
  if (!isLikeNone(image_config)) {
444
444
  _assertClass(image_config, WasmInlineImageConfig);
445
- ptr1 = image_config.__destroy_into_raw();
445
+ ptr0 = image_config.__destroy_into_raw();
446
446
  }
447
- wasm.convertWithInlineImages(retptr, ptr0, len0, addHeapObject(options), ptr1);
447
+ wasm.convertBytesWithInlineImages(retptr, addHeapObject(html), addHeapObject(options), ptr0);
448
448
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
449
449
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
450
450
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -4,7 +4,7 @@
4
4
  "collaborators": [
5
5
  "Na'aman Hirschfeld <nhirschfeld@gmail.com>"
6
6
  ],
7
- "version": "2.8.0",
7
+ "version": "2.8.1",
8
8
  "license": "MIT",
9
9
  "repository": {
10
10
  "type": "git",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "html-to-markdown-wasm",
3
- "version": "2.8.0",
3
+ "version": "2.8.1",
4
4
  "description": "High-performance HTML to Markdown converter - WebAssembly bindings",
5
5
  "main": "dist/html_to_markdown_wasm.js",
6
6
  "types": "dist/html_to_markdown_wasm.d.ts",