@ai-react-markdown/engine 2.3.1 → 2.3.3

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/index.d.cts CHANGED
@@ -1200,9 +1200,11 @@ declare function buildPhantomSuffix(phantoms: PhantomLabels): string;
1200
1200
  /**
1201
1201
  * Custom mdast-util-to-hast handlers for cross-chunk label resolution.
1202
1202
  *
1203
- * Direction A: `footnoteDefinitionHandler` mutates `state.footnoteOrder` so
1204
- * `state.footer()` emits a `<section data-footnotes>` even when no
1205
- * `footnoteReference` exists locally (orphan-def protection).
1203
+ * Direction A: `footnoteDefinitionHandler` mutates `state.footnoteOrder` (and
1204
+ * seeds `state.footnoteCounts` to 0) so `state.footer()` emits a
1205
+ * `<section data-footnotes>` even when no `footnoteReference` exists locally
1206
+ * (orphan-def protection), without the default reference handler
1207
+ * double-registering ids whose definition precedes their first reference.
1206
1208
  *
1207
1209
  * Direction B: `linkReferenceHandler` / `imageReferenceHandler` /
1208
1210
  * `footnoteReferenceHandler` short-circuit the default to-hast output and
package/dist/index.d.ts CHANGED
@@ -1200,9 +1200,11 @@ declare function buildPhantomSuffix(phantoms: PhantomLabels): string;
1200
1200
  /**
1201
1201
  * Custom mdast-util-to-hast handlers for cross-chunk label resolution.
1202
1202
  *
1203
- * Direction A: `footnoteDefinitionHandler` mutates `state.footnoteOrder` so
1204
- * `state.footer()` emits a `<section data-footnotes>` even when no
1205
- * `footnoteReference` exists locally (orphan-def protection).
1203
+ * Direction A: `footnoteDefinitionHandler` mutates `state.footnoteOrder` (and
1204
+ * seeds `state.footnoteCounts` to 0) so `state.footer()` emits a
1205
+ * `<section data-footnotes>` even when no `footnoteReference` exists locally
1206
+ * (orphan-def protection), without the default reference handler
1207
+ * double-registering ids whose definition precedes their first reference.
1206
1208
  *
1207
1209
  * Direction B: `linkReferenceHandler` / `imageReferenceHandler` /
1208
1210
  * `footnoteReferenceHandler` short-circuit the default to-hast output and
@@ -1964,6 +1964,7 @@ function buildCrossChunkHandlers() {
1964
1964
  }
1965
1965
  if (s.options.preserveOrphan && !s.footnoteOrder.includes(id)) {
1966
1966
  s.footnoteOrder.push(id);
1967
+ if (!s.footnoteCounts.has(id)) s.footnoteCounts.set(id, 0);
1967
1968
  }
1968
1969
  return void 0;
1969
1970
  },