@kreuzberg/html-to-markdown-wasm 3.6.0-rc.9 → 3.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4376,7 +4376,21 @@ if (Symbol.dispose) WasmNodeContent.prototype[Symbol.dispose] = WasmNodeContent.
4376
4376
  * Context information passed to all visitor methods.
4377
4377
  *
4378
4378
  * Provides comprehensive metadata about the current node being visited,
4379
- * including its type, attributes, position in the DOM tree, and parent context.
4379
+ * including its type, tag name, position in the DOM tree, and parent context.
4380
+ *
4381
+ * ## Attributes
4382
+ *
4383
+ * Access attributes via `NodeContext.attributes`, which returns
4384
+ * `&BTreeMap<String, String>`. When the context was built with
4385
+ * `NodeContext.with_lazy_attributes` (the hot path inside the converter),
4386
+ * the map is only materialized on the first call — if the visitor never reads
4387
+ * attributes, the allocation is skipped.
4388
+ *
4389
+ * ## Lifetimes
4390
+ *
4391
+ * String fields use `Cow<'_, str>` so the converter can pass slices directly
4392
+ * out of the parsed DOM without allocating. Visitor implementations that need
4393
+ * to outlive the callback should call `NodeContext.into_owned`.
4380
4394
  */
4381
4395
  export class WasmNodeContext {
4382
4396
  static __wrap(ptr) {
@@ -4396,9 +4410,14 @@ export class WasmNodeContext {
4396
4410
  wasm.__wbg_wasmnodecontext_free(ptr, 0);
4397
4411
  }
4398
4412
  /**
4413
+ * Return a reference to the attribute map.
4414
+ *
4415
+ * If the context was built with `NodeContext.with_lazy_attributes`, the
4416
+ * map is materialized on the first call and cached for subsequent calls.
4417
+ * If this method is never called, no allocation occurs for attributes.
4399
4418
  * @returns {any}
4400
4419
  */
4401
- get attributes() {
4420
+ attributes() {
4402
4421
  const ret = wasm.wasmnodecontext_attributes(this.__wbg_ptr);
4403
4422
  return takeObject(ret);
4404
4423
  }
@@ -4423,6 +4442,14 @@ export class WasmNodeContext {
4423
4442
  const ret = wasm.wasmnodecontext_indexInParent(this.__wbg_ptr);
4424
4443
  return ret >>> 0;
4425
4444
  }
4445
+ /**
4446
+ * Promote any borrowed fields into owned storage so the context can outlive `'a`.
4447
+ * @returns {WasmNodeContext}
4448
+ */
4449
+ intoOwned() {
4450
+ const ret = wasm.wasmnodecontext_intoOwned(this.__wbg_ptr);
4451
+ return WasmNodeContext.__wrap(ret);
4452
+ }
4426
4453
  /**
4427
4454
  * @returns {boolean}
4428
4455
  */
@@ -4433,18 +4460,17 @@ export class WasmNodeContext {
4433
4460
  /**
4434
4461
  * @param {WasmNodeType} nodeType
4435
4462
  * @param {string} tagName
4436
- * @param {any} attributes
4437
4463
  * @param {number} depth
4438
4464
  * @param {number} indexInParent
4439
4465
  * @param {boolean} isInline
4440
4466
  * @param {string | null} [parentTag]
4441
4467
  */
4442
- constructor(nodeType, tagName, attributes, depth, indexInParent, isInline, parentTag) {
4468
+ constructor(nodeType, tagName, depth, indexInParent, isInline, parentTag) {
4443
4469
  const ptr0 = passStringToWasm0(tagName, wasm.__wbindgen_export, wasm.__wbindgen_export2);
4444
4470
  const len0 = WASM_VECTOR_LEN;
4445
4471
  var ptr1 = isLikeNone(parentTag) ? 0 : passStringToWasm0(parentTag, wasm.__wbindgen_export, wasm.__wbindgen_export2);
4446
4472
  var len1 = WASM_VECTOR_LEN;
4447
- const ret = wasm.wasmnodecontext_new(nodeType, ptr0, len0, addHeapObject(attributes), depth, indexInParent, isInline, ptr1, len1);
4473
+ const ret = wasm.wasmnodecontext_new(nodeType, ptr0, len0, depth, indexInParent, isInline, ptr1, len1);
4448
4474
  this.__wbg_ptr = ret;
4449
4475
  WasmNodeContextFinalization.register(this, this.__wbg_ptr, this);
4450
4476
  return this;
@@ -4487,12 +4513,6 @@ export class WasmNodeContext {
4487
4513
  wasm.__wbindgen_add_to_stack_pointer(16);
4488
4514
  }
4489
4515
  }
4490
- /**
4491
- * @param {any} value
4492
- */
4493
- set attributes(value) {
4494
- wasm.wasmnodecontext_set_attributes(this.__wbg_ptr, addHeapObject(value));
4495
- }
4496
4516
  /**
4497
4517
  * @param {number} value
4498
4518
  */
@@ -4552,6 +4572,28 @@ export class WasmNodeContext {
4552
4572
  wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
4553
4573
  }
4554
4574
  }
4575
+ /**
4576
+ * Construct a `NodeContext` with an owned attribute map.
4577
+ *
4578
+ * Prefer `NodeContext.with_lazy_attributes` (pub(crate)) inside the
4579
+ * converter to avoid the eager `collect_tag_attributes` allocation.
4580
+ * @param {WasmNodeType} node_type
4581
+ * @param {string} tag_name
4582
+ * @param {any} attributes
4583
+ * @param {number} depth
4584
+ * @param {number} index_in_parent
4585
+ * @param {string | null | undefined} parent_tag
4586
+ * @param {boolean} is_inline
4587
+ * @returns {WasmNodeContext}
4588
+ */
4589
+ static withOwnedAttributes(node_type, tag_name, attributes, depth, index_in_parent, parent_tag, is_inline) {
4590
+ const ptr0 = passStringToWasm0(tag_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
4591
+ const len0 = WASM_VECTOR_LEN;
4592
+ var ptr1 = isLikeNone(parent_tag) ? 0 : passStringToWasm0(parent_tag, wasm.__wbindgen_export, wasm.__wbindgen_export2);
4593
+ var len1 = WASM_VECTOR_LEN;
4594
+ const ret = wasm.wasmnodecontext_withOwnedAttributes(node_type, ptr0, len0, addHeapObject(attributes), depth, index_in_parent, ptr1, len1, is_inline);
4595
+ return WasmNodeContext.__wrap(ret);
4596
+ }
4555
4597
  }
4556
4598
  if (Symbol.dispose) WasmNodeContext.prototype[Symbol.dispose] = WasmNodeContext.prototype.free;
4557
4599
 
@@ -5008,7 +5050,7 @@ export class WasmProcessingWarning {
5008
5050
  if (Symbol.dispose) WasmProcessingWarning.prototype[Symbol.dispose] = WasmProcessingWarning.prototype.free;
5009
5051
 
5010
5052
  /**
5011
- * Structured data block (JSON-LD, Microdata, or RDFa).
5053
+ * Structured data block (JSON-LD, Microdata, or `RDFa`).
5012
5054
  *
5013
5055
  * Represents machine-readable structured data found in the document.
5014
5056
  * JSON-LD blocks are collected as raw JSON strings for flexibility.
@@ -5606,20 +5648,46 @@ export function convert(html, options) {
5606
5648
  function __wbg_get_imports() {
5607
5649
  const import0 = {
5608
5650
  __proto__: null,
5609
- __wbg___wbindgen_is_function_754e9f305ff6029e: function(arg0) {
5651
+ __wbg_Error_9dc85fe1bc224456: function(arg0, arg1) {
5652
+ const ret = Error(getStringFromWasm0(arg0, arg1));
5653
+ return addHeapObject(ret);
5654
+ },
5655
+ __wbg___wbindgen_boolean_get_b131b2f36d6b2f55: function(arg0) {
5656
+ const v = getObject(arg0);
5657
+ const ret = typeof(v) === 'boolean' ? v : undefined;
5658
+ return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
5659
+ },
5660
+ __wbg___wbindgen_debug_string_56c147eb1a51f0c4: function(arg0, arg1) {
5661
+ const ret = debugString(getObject(arg1));
5662
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
5663
+ const len1 = WASM_VECTOR_LEN;
5664
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
5665
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
5666
+ },
5667
+ __wbg___wbindgen_is_function_147961669f068cd4: function(arg0) {
5610
5668
  const ret = typeof(getObject(arg0)) === 'function';
5611
5669
  return ret;
5612
5670
  },
5613
- __wbg___wbindgen_is_object_56732c2bc353f41d: function(arg0) {
5671
+ __wbg___wbindgen_is_object_3a2c414391dbf751: function(arg0) {
5614
5672
  const val = getObject(arg0);
5615
5673
  const ret = typeof(val) === 'object' && val !== null;
5616
5674
  return ret;
5617
5675
  },
5618
- __wbg___wbindgen_is_undefined_67b456be8673d3d7: function(arg0) {
5676
+ __wbg___wbindgen_is_undefined_4410e3c20a99fa97: function(arg0) {
5619
5677
  const ret = getObject(arg0) === undefined;
5620
5678
  return ret;
5621
5679
  },
5622
- __wbg___wbindgen_string_get_72bdf95d3ae505b1: function(arg0, arg1) {
5680
+ __wbg___wbindgen_jsval_loose_eq_e07e3b1f5db6da6c: function(arg0, arg1) {
5681
+ const ret = getObject(arg0) == getObject(arg1);
5682
+ return ret;
5683
+ },
5684
+ __wbg___wbindgen_number_get_588ed6b97f0d7e14: function(arg0, arg1) {
5685
+ const obj = getObject(arg1);
5686
+ const ret = typeof(obj) === 'number' ? obj : undefined;
5687
+ getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
5688
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
5689
+ },
5690
+ __wbg___wbindgen_string_get_fa2687d531ed17a5: function(arg0, arg1) {
5623
5691
  const obj = getObject(arg1);
5624
5692
  const ret = typeof(obj) === 'string' ? obj : undefined;
5625
5693
  var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
@@ -5627,47 +5695,126 @@ function __wbg_get_imports() {
5627
5695
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
5628
5696
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
5629
5697
  },
5630
- __wbg___wbindgen_throw_1506f2235d1bdba0: function(arg0, arg1) {
5698
+ __wbg___wbindgen_throw_bbadd78c1bac3a77: function(arg0, arg1) {
5631
5699
  throw new Error(getStringFromWasm0(arg0, arg1));
5632
5700
  },
5633
- __wbg_apply_292b6d94e4f92b15: function() { return handleError(function (arg0, arg1, arg2) {
5701
+ __wbg_apply_5d99f956e2dda74d: function() { return handleError(function (arg0, arg1, arg2) {
5634
5702
  const ret = getObject(arg0).apply(getObject(arg1), getObject(arg2));
5635
5703
  return addHeapObject(ret);
5636
5704
  }, arguments); },
5637
- __wbg_get_de6a0f7d4d18a304: function() { return handleError(function (arg0, arg1) {
5705
+ __wbg_call_91f00ddc43e01490: function() { return handleError(function (arg0, arg1) {
5706
+ const ret = getObject(arg0).call(getObject(arg1));
5707
+ return addHeapObject(ret);
5708
+ }, arguments); },
5709
+ __wbg_done_6a8439e544ec6206: function(arg0) {
5710
+ const ret = getObject(arg0).done;
5711
+ return ret;
5712
+ },
5713
+ __wbg_entries_5a6a7e7e0df09fe5: function(arg0) {
5714
+ const ret = Object.entries(getObject(arg0));
5715
+ return addHeapObject(ret);
5716
+ },
5717
+ __wbg_get_44e98e27bda25b5b: function() { return handleError(function (arg0, arg1) {
5718
+ const ret = Reflect.get(getObject(arg0), getObject(arg1));
5719
+ return addHeapObject(ret);
5720
+ }, arguments); },
5721
+ __wbg_get_4b90d6d8c5deb5d5: function(arg0, arg1) {
5722
+ const ret = getObject(arg0)[arg1 >>> 0];
5723
+ return addHeapObject(ret);
5724
+ },
5725
+ __wbg_get_52a8a619f7b88df6: function() { return handleError(function (arg0, arg1) {
5638
5726
  const ret = Reflect.get(getObject(arg0), getObject(arg1));
5639
5727
  return addHeapObject(ret);
5640
5728
  }, arguments); },
5641
- __wbg_has_73740b27f436fed3: function() { return handleError(function (arg0, arg1) {
5729
+ __wbg_get_unchecked_46e778e3cec74b5e: function(arg0, arg1) {
5730
+ const ret = getObject(arg0)[arg1 >>> 0];
5731
+ return addHeapObject(ret);
5732
+ },
5733
+ __wbg_has_14676d88c1340d2c: function() { return handleError(function (arg0, arg1) {
5642
5734
  const ret = Reflect.has(getObject(arg0), getObject(arg1));
5643
5735
  return ret;
5644
5736
  }, arguments); },
5645
- __wbg_new_ce1ab61c1c2b300d: function() {
5646
- const ret = new Object();
5737
+ __wbg_instanceof_ArrayBuffer_a581da923203f29f: function(arg0) {
5738
+ let result;
5739
+ try {
5740
+ result = getObject(arg0) instanceof ArrayBuffer;
5741
+ } catch (_) {
5742
+ result = false;
5743
+ }
5744
+ const ret = result;
5745
+ return ret;
5746
+ },
5747
+ __wbg_instanceof_Uint8Array_b6fe1ac89eba107e: function(arg0) {
5748
+ let result;
5749
+ try {
5750
+ result = getObject(arg0) instanceof Uint8Array;
5751
+ } catch (_) {
5752
+ result = false;
5753
+ }
5754
+ const ret = result;
5755
+ return ret;
5756
+ },
5757
+ __wbg_iterator_9b36cebf3be7b7cd: function() {
5758
+ const ret = Symbol.iterator;
5647
5759
  return addHeapObject(ret);
5648
5760
  },
5649
- __wbg_new_d90091b82fdf5b91: function() {
5761
+ __wbg_length_68a9d5278d084f4f: function(arg0) {
5762
+ const ret = getObject(arg0).length;
5763
+ return ret;
5764
+ },
5765
+ __wbg_length_fb04d16d7bdf6d4c: function(arg0) {
5766
+ const ret = getObject(arg0).length;
5767
+ return ret;
5768
+ },
5769
+ __wbg_new_0b303268aa395a38: function() {
5650
5770
  const ret = new Array();
5651
5771
  return addHeapObject(ret);
5652
5772
  },
5653
- __wbg_parse_03863847d06c4e89: function() { return handleError(function (arg0, arg1) {
5773
+ __wbg_new_20b778a4c5c691c3: function() {
5774
+ const ret = new Object();
5775
+ return addHeapObject(ret);
5776
+ },
5777
+ __wbg_new_883c0db065f06efd: function() {
5778
+ const ret = new Map();
5779
+ return addHeapObject(ret);
5780
+ },
5781
+ __wbg_new_b06772b280cc6e52: function(arg0) {
5782
+ const ret = new Uint8Array(getObject(arg0));
5783
+ return addHeapObject(ret);
5784
+ },
5785
+ __wbg_next_8cb028b6ba50743f: function() { return handleError(function (arg0) {
5786
+ const ret = getObject(arg0).next();
5787
+ return addHeapObject(ret);
5788
+ }, arguments); },
5789
+ __wbg_next_cfd0b146c9538df8: function(arg0) {
5790
+ const ret = getObject(arg0).next;
5791
+ return addHeapObject(ret);
5792
+ },
5793
+ __wbg_parse_246201845d0eb98c: function() { return handleError(function (arg0, arg1) {
5654
5794
  const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
5655
5795
  return addHeapObject(ret);
5656
5796
  }, arguments); },
5657
- __wbg_push_a6822215aa43e71c: function(arg0, arg1) {
5797
+ __wbg_prototypesetcall_956c7493c68e29b4: function(arg0, arg1, arg2) {
5798
+ Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), getObject(arg2));
5799
+ },
5800
+ __wbg_push_ceb8ef046afb2041: function(arg0, arg1) {
5658
5801
  const ret = getObject(arg0).push(getObject(arg1));
5659
5802
  return ret;
5660
5803
  },
5661
5804
  __wbg_set_6be42768c690e380: function(arg0, arg1, arg2) {
5662
5805
  getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
5663
5806
  },
5664
- __wbg_set_6e30c9374c26414c: function() { return handleError(function (arg0, arg1, arg2) {
5807
+ __wbg_set_a6ba3ac0e634b822: function() { return handleError(function (arg0, arg1, arg2) {
5665
5808
  const ret = Reflect.set(getObject(arg0), getObject(arg1), getObject(arg2));
5666
5809
  return ret;
5667
5810
  }, arguments); },
5668
- __wbg_set_dca99999bba88a9a: function(arg0, arg1, arg2) {
5811
+ __wbg_set_da33c120a6584674: function(arg0, arg1, arg2) {
5669
5812
  getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
5670
5813
  },
5814
+ __wbg_value_3d3defe09fb1ffca: function(arg0) {
5815
+ const ret = getObject(arg0).value;
5816
+ return addHeapObject(ret);
5817
+ },
5671
5818
  __wbg_wasmdocumentnode_new: function(arg0) {
5672
5819
  const ret = WasmDocumentNode.__wrap(arg0);
5673
5820
  return addHeapObject(ret);
@@ -5860,6 +6007,71 @@ function _assertClass(instance, klass) {
5860
6007
  }
5861
6008
  }
5862
6009
 
6010
+ function debugString(val) {
6011
+ // primitive types
6012
+ const type = typeof val;
6013
+ if (type == 'number' || type == 'boolean' || val == null) {
6014
+ return `${val}`;
6015
+ }
6016
+ if (type == 'string') {
6017
+ return `"${val}"`;
6018
+ }
6019
+ if (type == 'symbol') {
6020
+ const description = val.description;
6021
+ if (description == null) {
6022
+ return 'Symbol';
6023
+ } else {
6024
+ return `Symbol(${description})`;
6025
+ }
6026
+ }
6027
+ if (type == 'function') {
6028
+ const name = val.name;
6029
+ if (typeof name == 'string' && name.length > 0) {
6030
+ return `Function(${name})`;
6031
+ } else {
6032
+ return 'Function';
6033
+ }
6034
+ }
6035
+ // objects
6036
+ if (Array.isArray(val)) {
6037
+ const length = val.length;
6038
+ let debug = '[';
6039
+ if (length > 0) {
6040
+ debug += debugString(val[0]);
6041
+ }
6042
+ for(let i = 1; i < length; i++) {
6043
+ debug += ', ' + debugString(val[i]);
6044
+ }
6045
+ debug += ']';
6046
+ return debug;
6047
+ }
6048
+ // Test for built-in
6049
+ const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
6050
+ let className;
6051
+ if (builtInMatches && builtInMatches.length > 1) {
6052
+ className = builtInMatches[1];
6053
+ } else {
6054
+ // Failed to match the standard '[object ClassName]'
6055
+ return toString.call(val);
6056
+ }
6057
+ if (className == 'Object') {
6058
+ // we're a user defined class or Object
6059
+ // JSON.stringify avoids problems with cycles, and is generally much
6060
+ // easier than looping through ownProperties of `val`.
6061
+ try {
6062
+ return 'Object(' + JSON.stringify(val) + ')';
6063
+ } catch (_) {
6064
+ return 'Object';
6065
+ }
6066
+ }
6067
+ // errors
6068
+ if (val instanceof Error) {
6069
+ return `${val.name}: ${val.message}\n${val.stack}`;
6070
+ }
6071
+ // TODO we could test for more things here, like `Set`s and `Map`s.
6072
+ return className;
6073
+ }
6074
+
5863
6075
  function dropObject(idx) {
5864
6076
  if (idx < 1028) return;
5865
6077
  heap[idx] = heap_next;
@@ -5881,6 +6093,11 @@ function getArrayU32FromWasm0(ptr, len) {
5881
6093
  return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
5882
6094
  }
5883
6095
 
6096
+ function getArrayU8FromWasm0(ptr, len) {
6097
+ ptr = ptr >>> 0;
6098
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
6099
+ }
6100
+
5884
6101
  let cachedDataViewMemory0 = null;
5885
6102
  function getDataViewMemory0() {
5886
6103
  if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
@@ -16,7 +16,6 @@ export const __wbg_wasmimagemetadata_free: (a: number, b: number) => void;
16
16
  export const __wbg_wasmlinkmetadata_free: (a: number, b: number) => void;
17
17
  export const __wbg_wasmmetadataentry_free: (a: number, b: number) => void;
18
18
  export const __wbg_wasmnodecontent_free: (a: number, b: number) => void;
19
- export const __wbg_wasmnodecontext_free: (a: number, b: number) => void;
20
19
  export const __wbg_wasmpreprocessingoptions_free: (a: number, b: number) => void;
21
20
  export const __wbg_wasmprocessingwarning_free: (a: number, b: number) => void;
22
21
  export const __wbg_wasmstructureddata_free: (a: number, b: number) => void;
@@ -378,18 +377,13 @@ export const wasmnodecontent_term: (a: number, b: number) => void;
378
377
  export const wasmnodecontent_text: (a: number, b: number) => void;
379
378
  export const wasmnodecontext_attributes: (a: number) => number;
380
379
  export const wasmnodecontext_default: () => number;
381
- export const wasmnodecontext_indexInParent: (a: number) => number;
380
+ export const wasmnodecontext_intoOwned: (a: number) => number;
382
381
  export const wasmnodecontext_isInline: (a: number) => number;
383
- export const wasmnodecontext_new: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => number;
382
+ export const wasmnodecontext_new: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
384
383
  export const wasmnodecontext_nodeType: (a: number, b: number) => void;
385
- export const wasmnodecontext_parentTag: (a: number, b: number) => void;
386
- export const wasmnodecontext_set_attributes: (a: number, b: number) => void;
387
- export const wasmnodecontext_set_indexInParent: (a: number, b: number) => void;
388
384
  export const wasmnodecontext_set_isInline: (a: number, b: number) => void;
389
385
  export const wasmnodecontext_set_nodeType: (a: number, b: number) => void;
390
- export const wasmnodecontext_set_parentTag: (a: number, b: number, c: number) => void;
391
- export const wasmnodecontext_set_tagName: (a: number, b: number, c: number) => void;
392
- export const wasmnodecontext_tagName: (a: number, b: number) => void;
386
+ export const wasmnodecontext_withOwnedAttributes: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => number;
393
387
  export const wasmpreprocessingoptions_default: () => number;
394
388
  export const wasmpreprocessingoptions_enabled: (a: number) => number;
395
389
  export const wasmpreprocessingoptions_new: (a: number, b: number, c: number, d: number) => number;
@@ -443,6 +437,7 @@ export const wasmnodecontent_ordered: (a: number) => number;
443
437
  export const wasmnodecontent_new: () => number;
444
438
  export const wasmheadermetadata_set_depth: (a: number, b: number) => void;
445
439
  export const wasmnodecontext_set_depth: (a: number, b: number) => void;
440
+ export const wasmnodecontext_set_indexInParent: (a: number, b: number) => void;
446
441
  export const wasmtablegrid_set_cols: (a: number, b: number) => void;
447
442
  export const wasmtablegrid_set_rows: (a: number, b: number) => void;
448
443
  export const wasmtextannotation_set_end: (a: number, b: number) => void;
@@ -450,13 +445,19 @@ export const wasmtextannotation_set_start: (a: number, b: number) => void;
450
445
  export const wasmnodecontent_set_imageIndex: (a: number, b: number) => void;
451
446
  export const wasmheadermetadata_depth: (a: number) => number;
452
447
  export const wasmnodecontext_depth: (a: number) => number;
448
+ export const wasmnodecontext_indexInParent: (a: number) => number;
453
449
  export const wasmtablegrid_cols: (a: number) => number;
454
450
  export const wasmtablegrid_rows: (a: number) => number;
455
451
  export const wasmtextannotation_end: (a: number) => number;
456
452
  export const wasmtextannotation_start: (a: number) => number;
457
453
  export const wasmannotationkind_new: () => number;
454
+ export const wasmnodecontext_parentTag: (a: number, b: number) => void;
458
455
  export const wasmnodecontent_set_ordered: (a: number, b: number) => void;
456
+ export const wasmnodecontext_set_tagName: (a: number, b: number, c: number) => void;
457
+ export const wasmnodecontext_set_parentTag: (a: number, b: number, c: number) => void;
458
+ export const wasmnodecontext_tagName: (a: number, b: number) => void;
459
459
  export const wasmnodecontent_imageIndex: (a: number) => number;
460
+ export const __wbg_wasmnodecontext_free: (a: number, b: number) => void;
460
461
  export const __wbg_wasmpreprocessingoptionsupdate_free: (a: number, b: number) => void;
461
462
  export const __wbindgen_export: (a: number, b: number) => number;
462
463
  export const __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
@@ -572,14 +572,46 @@ export class WasmNodeContent {
572
572
  * Context information passed to all visitor methods.
573
573
  *
574
574
  * Provides comprehensive metadata about the current node being visited,
575
- * including its type, attributes, position in the DOM tree, and parent context.
575
+ * including its type, tag name, position in the DOM tree, and parent context.
576
+ *
577
+ * ## Attributes
578
+ *
579
+ * Access attributes via `NodeContext.attributes`, which returns
580
+ * `&BTreeMap<String, String>`. When the context was built with
581
+ * `NodeContext.with_lazy_attributes` (the hot path inside the converter),
582
+ * the map is only materialized on the first call — if the visitor never reads
583
+ * attributes, the allocation is skipped.
584
+ *
585
+ * ## Lifetimes
586
+ *
587
+ * String fields use `Cow<'_, str>` so the converter can pass slices directly
588
+ * out of the parsed DOM without allocating. Visitor implementations that need
589
+ * to outlive the callback should call `NodeContext.into_owned`.
576
590
  */
577
591
  export class WasmNodeContext {
578
592
  free(): void;
579
593
  [Symbol.dispose](): void;
594
+ /**
595
+ * Return a reference to the attribute map.
596
+ *
597
+ * If the context was built with `NodeContext.with_lazy_attributes`, the
598
+ * map is materialized on the first call and cached for subsequent calls.
599
+ * If this method is never called, no allocation occurs for attributes.
600
+ */
601
+ attributes(): any;
580
602
  static default(): WasmNodeContext;
581
- constructor(nodeType: WasmNodeType, tagName: string, attributes: any, depth: number, indexInParent: number, isInline: boolean, parentTag?: string | null);
582
- attributes: any;
603
+ /**
604
+ * Promote any borrowed fields into owned storage so the context can outlive `'a`.
605
+ */
606
+ intoOwned(): WasmNodeContext;
607
+ constructor(nodeType: WasmNodeType, tagName: string, depth: number, indexInParent: number, isInline: boolean, parentTag?: string | null);
608
+ /**
609
+ * Construct a `NodeContext` with an owned attribute map.
610
+ *
611
+ * Prefer `NodeContext.with_lazy_attributes` (pub(crate)) inside the
612
+ * converter to avoid the eager `collect_tag_attributes` allocation.
613
+ */
614
+ static withOwnedAttributes(node_type: WasmNodeType, tag_name: string, attributes: any, depth: number, index_in_parent: number, parent_tag: string | null | undefined, is_inline: boolean): WasmNodeContext;
583
615
  depth: number;
584
616
  indexInParent: number;
585
617
  isInline: boolean;
@@ -774,7 +806,7 @@ export class WasmProcessingWarning {
774
806
  }
775
807
 
776
808
  /**
777
- * Structured data block (JSON-LD, Microdata, or RDFa).
809
+ * Structured data block (JSON-LD, Microdata, or `RDFa`).
778
810
  *
779
811
  * Represents machine-readable structured data found in the document.
780
812
  * JSON-LD blocks are collected as raw JSON strings for flexibility.