@ai-react-markdown/core 1.4.3 → 1.4.4

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
@@ -318,6 +318,16 @@ type IsNever<T> = [T] extends [never] ? true : false;
318
318
  // https://github.com/sindresorhus/type-fest
319
319
  // SPDX-License-Identifier: (MIT OR CC0-1.0)
320
320
  // Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
321
+ //
322
+ // Vendored verbatim from upstream. The `any[]` spellings in
323
+ // `HasMultipleCallSignatures` and the function-fallback branch are
324
+ // load-bearing for type-fest's variadic-arity matching — replacing them
325
+ // with `unknown[]` would either narrow or widen the inference in a
326
+ // non-equivalent way, and the test suite for those exact helpers lives in
327
+ // type-fest's own repo. Disable the rule at the file scope to mirror
328
+ // upstream while keeping the rest of the package's `no-explicit-any`
329
+ // contract strict.
330
+ /* eslint-disable @typescript-eslint/no-explicit-any */
321
331
 
322
332
 
323
333
 
@@ -664,7 +674,7 @@ declare function useAIMarkdownRenderState<TConfig extends AIMarkdownRenderConfig
664
674
  *
665
675
  * Metadata lives in a separate React context so that changes to metadata
666
676
  * do not cause re-renders in components that only consume render state
667
- * (e.g. {@link MarkdownContent}).
677
+ * (e.g. the internal `MarkdownContent` renderer).
668
678
  *
669
679
  * ### `TMetadata` is a caller-asserted type
670
680
  *
@@ -742,14 +752,16 @@ interface AIMarkdownMetadataProviderProps<TMetadata extends AIMarkdownMetadata =
742
752
  type AIMDContentPreprocessor = (content: string) => string;
743
753
 
744
754
  /**
745
- * Builds a `rehype-sanitize` schema by handing the caller a deep clone of the
746
- * library default ({@link sanitizeSchema}) to mutate or replace.
755
+ * Builds a `rehype-sanitize` schema by handing the caller a deep clone of
756
+ * the library's internal default schema to mutate or replace.
747
757
  *
748
758
  * The mutate-and-return pattern matches the ergonomics of Next.js's
749
759
  * `webpack(config)` and Express middleware: a callback receives a draft,
750
760
  * either modifies it in place (returning nothing) or returns a fresh object
751
761
  * to replace it. The library guarantees the draft is a deep clone, so direct
752
- * mutation never leaks into the shared default singleton.
762
+ * mutation never leaks into the singleton and the singleton itself is not
763
+ * exported, so consumers cannot accidentally hand-roll a schema that drops
764
+ * the library's cross-chunk tag allowlist or KaTeX className additions.
753
765
  *
754
766
  * @module components/extendSanitizeSchema
755
767
  */
@@ -792,6 +804,16 @@ type SanitizeSchema = typeof defaultSchema;
792
804
  * }));
793
805
  * ```
794
806
  *
807
+ * @example Inspect the library default (e.g. to learn what's already allowed):
808
+ * ```ts
809
+ * // The draft handed to the modifier IS the library default, deep-cloned.
810
+ * // Logging it once at module load surfaces every default field — protocols,
811
+ * // attributes, tagNames, etc. — without ever exposing the singleton itself.
812
+ * extendSanitizeSchema((s) => {
813
+ * console.log('default sanitize schema:', s);
814
+ * });
815
+ * ```
816
+ *
795
817
  * @remarks Allowing a protocol on `protocols.href` lets the URL through the
796
818
  * SECOND sanitize gate. The FIRST gate (`urlTransform`) must permit the
797
819
  * same protocol independently — see the `urlTransform` prop on
@@ -853,23 +875,6 @@ declare function extendSanitizeSchema(modifier: (draft: SanitizeSchema) => Sanit
853
875
  */
854
876
  declare function useStableValue<T>(value: T): T;
855
877
 
856
- /**
857
- * Builds the `rehype-sanitize` schema used by {@link MarkdownContent}.
858
- *
859
- * Extracted into its own module so the merge logic can be unit-tested in
860
- * isolation without pulling in React or the full markdown pipeline.
861
- *
862
- * @module components/sanitizeSchema
863
- */
864
-
865
- type Schema = typeof defaultSchema;
866
- /**
867
- * The full sanitize schema used by the markdown renderer: extends
868
- * `defaultSchema` to allow `<mark>`, the KaTeX math class names, and the
869
- * three custom hast tags emitted by cross-chunk coordination handlers.
870
- */
871
- declare const sanitizeSchema: Schema;
872
-
873
878
  /**
874
879
  * Cross-chunk shared state. Holds per-chunk contributions (refs, defs,
875
880
  * linkDefs) keyed by Symbol identity allocated via useId reactId, with
@@ -920,45 +925,62 @@ interface ChunkData {
920
925
  ownFootnoteLabels: Set<string>;
921
926
  ownLinkLabels: Set<string>;
922
927
  }
928
+ /**
929
+ * Public, read-only view of the cross-chunk registry. This is the type
930
+ * surfaced by `useDocumentRegistry` and re-exported from the package
931
+ * barrel. Consumers can:
932
+ *
933
+ * - read the registry's current state (`chunkOrder`, `chunkData`,
934
+ * `labelSet`, `version`)
935
+ * - observe changes (`subscribe`)
936
+ * - run selectors (`globalNumber`, `resolveLinkDef`, …)
937
+ *
938
+ * Mutators — `registerChunk`, `allocateSymbol`, `releaseSymbol`,
939
+ * `contributeLabels`, `contributeChunkData` — are intentionally off this
940
+ * interface. Driving the registry directly is reserved for internal
941
+ * coordinators (the package's own `MarkdownContent` renderer) and tests,
942
+ * which import the wider `RegistryInternal` type from this module.
943
+ * `RegistryInternal` is exported here but NOT re-exported from the package
944
+ * barrel — keeping mutators off the public surface prevents a misbehaving
945
+ * consumer-component from corrupting refcounts, skipping version bumps, or
946
+ * otherwise breaking the invariants the renderer relies on.
947
+ */
923
948
  interface Registry {
924
- /** Chunk mount-order Symbol list. **Read-only from outside the registry.**
925
- * Direct mutation (`.push`, `.splice`, index assignment) corrupts
926
- * footnote numbering, "last chunk" detection, and eviction. Use the
927
- * `allocateSymbol` / `releaseSymbol` / `registerChunk` API instead. */
949
+ /** Chunk mount-order Symbol list. **Read-only.** Direct mutation
950
+ * (`.push`, `.splice`, index assignment) corrupts footnote numbering,
951
+ * "last chunk" detection, and eviction. */
928
952
  readonly chunkOrder: readonly symbol[];
929
- /** Chunk Symbol → contribution payload. **Read-only from outside.**
930
- * Use `contributeChunkData` / `contributeLabels` / `registerChunk` to
931
- * publish; direct `.set` / `.delete` bypasses version bumps and
932
- * subscriber wake-ups. */
953
+ /** Chunk Symbol → contribution payload. **Read-only.** Direct `.set` /
954
+ * `.delete` bypasses version bumps and subscriber wake-ups. */
933
955
  readonly chunkData: ReadonlyMap<symbol, ChunkData>;
934
956
  /** Union of own-def labels across all chunks. PASS 0.5 phantom-injection
935
- * driver. **Read-only from outside.** The registry derives this from
936
- * per-chunk contributions; direct mutation breaks the derivation. */
957
+ * driver. **Read-only.** The registry derives this from per-chunk
958
+ * contributions; direct mutation breaks the derivation. */
937
959
  readonly labelSet: {
938
960
  readonly footnoteLabels: ReadonlySet<string>;
939
961
  readonly linkLabels: ReadonlySet<string>;
940
962
  };
941
- /** Monotonic version counter bumped by every mutation. **Read-only from
942
- * outside** — consumers should observe via `subscribe`, not by writing. */
963
+ /** Monotonic version counter bumped by every mutation. **Read-only**
964
+ * consumers should observe via `subscribe`, not by writing. */
943
965
  readonly version: number;
944
- /** Allocate (or reuse, for Strict Mode remount) the chunk Symbol for
945
- * `reactId` AND publish this chunk's own def labels (footnotes + links)
946
- * in one call. Canonical pair API used by `MarkdownContent`'s allocate
947
- * effect — combining the two reduces the pair to a single registry
948
- * version step, which downstream consumers see as one wake-up rather
949
- * than two (the second was already coalesced by microtask, but this
950
- * keeps the version monotonic-by-1-per-mount which makes debugging
951
- * easier). The granular `allocateSymbol` / `contributeLabels` methods
952
- * remain available for tests that need to exercise each step. */
953
- registerChunk(reactId: string, footnotes: Set<string>, links: Set<string>): symbol;
954
- allocateSymbol(reactId: string): symbol;
955
- releaseSymbol(reactId: string): void;
956
- contributeLabels(symbol: symbol, footnotes: Set<string>, links: Set<string>): void;
957
- contributeChunkData(symbol: symbol, data: ChunkData): void;
958
966
  subscribe(cb: () => void): () => void;
959
967
  canonicalFootnoteFor(label: string): symbol | null;
960
968
  canonicalLinkFor(label: string): symbol | null;
961
969
  globalNumber(label: string): number | null;
970
+ /**
971
+ * Resolve a cross-chunk link definition by label. The returned `url` is the
972
+ * value the contributing chunk's `urlTransform` produced — cross-chunk
973
+ * link/image references run a second, per-attribute sanitization pass
974
+ * (`urlTransform` + `sanitizeSchema.protocols`) at render time, so the
975
+ * placeholder components themselves never trust this value blindly.
976
+ *
977
+ * Consumers reading `def.url` directly (custom backlink panels, analytics,
978
+ * dev tooling) receive a defense-in-depth-filtered string but should still
979
+ * pipe it through their own `urlTransform` if they intend to render it as
980
+ * an `href`/`src` — the contribute-time pass uses the `'href'` key and a
981
+ * synthetic `<a>` node, so a key-aware policy may treat the value
982
+ * differently when used as an `<img src>`.
983
+ */
962
984
  resolveLinkDef(label: string): LinkDef | null;
963
985
  getRefsForLabel(label: string): number;
964
986
  /** Map a chunk-local footnote-ref occurrence index (1-based, as emitted by
@@ -1110,8 +1132,8 @@ interface AIMarkdownProps<TConfig extends AIMarkdownRenderConfig = AIMarkdownRen
1110
1132
  *
1111
1133
  * Allowing a protocol here is necessary but **not sufficient** to render
1112
1134
  * a link — the second gate (`rehype-sanitize`) also enforces its own
1113
- * protocol allowlist. See the {@link sanitizeSchema} prop and the
1114
- * matching {@link extendSanitizeSchema} helper for the second gate.
1135
+ * protocol allowlist. See the `sanitizeSchema` prop on this component
1136
+ * and the {@link extendSanitizeSchema} helper for the second gate.
1115
1137
  *
1116
1138
  * **API stability**: the `UrlTransform` type tracks the upstream
1117
1139
  * `react-markdown` shape and may change with its major versions.
@@ -1119,10 +1141,11 @@ interface AIMarkdownProps<TConfig extends AIMarkdownRenderConfig = AIMarkdownRen
1119
1141
  urlTransform?: UrlTransform | null;
1120
1142
  /**
1121
1143
  * Override the `rehype-sanitize` schema applied to the rendered output.
1122
- * The library default ({@link sanitizeSchema}) extends `rehype-sanitize`'s
1123
- * own `defaultSchema` with the `<mark>` tag, KaTeX class names, and the
1124
- * cross-chunk coordination tags (`cross-chunk-link`, `cross-chunk-image`,
1125
- * `footnote-sup`).
1144
+ * The library default extends `rehype-sanitize`'s own `defaultSchema`
1145
+ * with the `<mark>` tag, KaTeX class names, and the cross-chunk
1146
+ * coordination tags (`cross-chunk-link`, `cross-chunk-image`,
1147
+ * `footnote-sup`). The default is not exported as a value — see
1148
+ * {@link extendSanitizeSchema} for how to inspect or extend it safely.
1126
1149
  *
1127
1150
  * **Recommended pattern**: build the schema with {@link extendSanitizeSchema}
1128
1151
  * (mutate-and-return form) so those library additions stay intact, and
@@ -1147,10 +1170,11 @@ interface AIMarkdownProps<TConfig extends AIMarkdownRenderConfig = AIMarkdownRen
1147
1170
  * lose its placeholders. Prefer the helper unless you have a specific
1148
1171
  * reason to opt out.
1149
1172
  *
1150
- * **Reference stability matters.** Inline `<AIMarkdown sanitizeSchema={{
1151
- * ...sanitizeSchema, protocols: {...} }}>` is mitigated by an internal
1152
- * `useStableValue` deep-equal pass, but the safer pattern is still
1153
- * module-scope. Development builds will `console.warn` on identity flips.
1173
+ * **Reference stability matters.** An inline call
1174
+ * (`sanitizeSchema={extendSanitizeSchema((s) => { })}`) is mitigated by
1175
+ * an internal `useStableValue` deep-equal pass, but the safer pattern is
1176
+ * still module-scope. Development builds will `console.warn` on identity
1177
+ * flips.
1154
1178
  *
1155
1179
  * **API stability**: the `SanitizeSchema` type tracks the upstream
1156
1180
  * `rehype-sanitize` shape and may change with its major versions.
@@ -1164,4 +1188,4 @@ interface AIMarkdownProps<TConfig extends AIMarkdownRenderConfig = AIMarkdownRen
1164
1188
  declare const AIMarkdownComponent: <TConfig extends AIMarkdownRenderConfig = AIMarkdownRenderConfig, TRenderData extends AIMarkdownMetadata = AIMarkdownMetadata>({ streaming, content, fontSize, contentPreprocessors, customComponents, defaultConfig, config, metadata, Typography, ExtraStyles, variant, colorScheme, documentId, urlTransform, sanitizeSchema, }: AIMarkdownProps<TConfig, TRenderData>) => react_jsx_runtime.JSX.Element;
1165
1189
  declare const _default: typeof AIMarkdownComponent;
1166
1190
 
1167
- export { type AIMDContentPreprocessor, type AIMarkdownColorScheme, type AIMarkdownCustomComponents, AIMarkdownDocuments, type AIMarkdownDocumentsProps, type AIMarkdownExtraStylesComponent, type AIMarkdownExtraStylesProps, type AIMarkdownMetadata, type AIMarkdownProps, type AIMarkdownRenderConfig, AIMarkdownRenderDisplayOptimizeAbility, AIMarkdownRenderExtraSyntax, type AIMarkdownRenderState, type AIMarkdownTypographyComponent, type AIMarkdownTypographyProps, type AIMarkdownVariant, type ChunkData, type FootnoteDef, type LinkDef, type PartialDeep, type RefKind, type RefRecord, type Registry, type SanitizeSchema, type UrlTransform, _default as default, defaultAIMarkdownRenderConfig, defaultUrlTransform, extendSanitizeSchema, sanitizeSchema, useAIMarkdownMetadata, useAIMarkdownRenderState, useDocumentRegistry, useStableValue };
1191
+ export { type AIMDContentPreprocessor, type AIMarkdownColorScheme, type AIMarkdownCustomComponents, AIMarkdownDocuments, type AIMarkdownDocumentsProps, type AIMarkdownExtraStylesComponent, type AIMarkdownExtraStylesProps, type AIMarkdownMetadata, type AIMarkdownProps, type AIMarkdownRenderConfig, AIMarkdownRenderDisplayOptimizeAbility, AIMarkdownRenderExtraSyntax, type AIMarkdownRenderState, type AIMarkdownTypographyComponent, type AIMarkdownTypographyProps, type AIMarkdownVariant, type ChunkData, type FootnoteDef, type LinkDef, type PartialDeep, type RefKind, type RefRecord, type Registry, type SanitizeSchema, type UrlTransform, _default as default, defaultAIMarkdownRenderConfig, defaultUrlTransform, extendSanitizeSchema, useAIMarkdownMetadata, useAIMarkdownRenderState, useDocumentRegistry, useStableValue };
package/dist/index.d.ts CHANGED
@@ -318,6 +318,16 @@ type IsNever<T> = [T] extends [never] ? true : false;
318
318
  // https://github.com/sindresorhus/type-fest
319
319
  // SPDX-License-Identifier: (MIT OR CC0-1.0)
320
320
  // Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
321
+ //
322
+ // Vendored verbatim from upstream. The `any[]` spellings in
323
+ // `HasMultipleCallSignatures` and the function-fallback branch are
324
+ // load-bearing for type-fest's variadic-arity matching — replacing them
325
+ // with `unknown[]` would either narrow or widen the inference in a
326
+ // non-equivalent way, and the test suite for those exact helpers lives in
327
+ // type-fest's own repo. Disable the rule at the file scope to mirror
328
+ // upstream while keeping the rest of the package's `no-explicit-any`
329
+ // contract strict.
330
+ /* eslint-disable @typescript-eslint/no-explicit-any */
321
331
 
322
332
 
323
333
 
@@ -664,7 +674,7 @@ declare function useAIMarkdownRenderState<TConfig extends AIMarkdownRenderConfig
664
674
  *
665
675
  * Metadata lives in a separate React context so that changes to metadata
666
676
  * do not cause re-renders in components that only consume render state
667
- * (e.g. {@link MarkdownContent}).
677
+ * (e.g. the internal `MarkdownContent` renderer).
668
678
  *
669
679
  * ### `TMetadata` is a caller-asserted type
670
680
  *
@@ -742,14 +752,16 @@ interface AIMarkdownMetadataProviderProps<TMetadata extends AIMarkdownMetadata =
742
752
  type AIMDContentPreprocessor = (content: string) => string;
743
753
 
744
754
  /**
745
- * Builds a `rehype-sanitize` schema by handing the caller a deep clone of the
746
- * library default ({@link sanitizeSchema}) to mutate or replace.
755
+ * Builds a `rehype-sanitize` schema by handing the caller a deep clone of
756
+ * the library's internal default schema to mutate or replace.
747
757
  *
748
758
  * The mutate-and-return pattern matches the ergonomics of Next.js's
749
759
  * `webpack(config)` and Express middleware: a callback receives a draft,
750
760
  * either modifies it in place (returning nothing) or returns a fresh object
751
761
  * to replace it. The library guarantees the draft is a deep clone, so direct
752
- * mutation never leaks into the shared default singleton.
762
+ * mutation never leaks into the singleton and the singleton itself is not
763
+ * exported, so consumers cannot accidentally hand-roll a schema that drops
764
+ * the library's cross-chunk tag allowlist or KaTeX className additions.
753
765
  *
754
766
  * @module components/extendSanitizeSchema
755
767
  */
@@ -792,6 +804,16 @@ type SanitizeSchema = typeof defaultSchema;
792
804
  * }));
793
805
  * ```
794
806
  *
807
+ * @example Inspect the library default (e.g. to learn what's already allowed):
808
+ * ```ts
809
+ * // The draft handed to the modifier IS the library default, deep-cloned.
810
+ * // Logging it once at module load surfaces every default field — protocols,
811
+ * // attributes, tagNames, etc. — without ever exposing the singleton itself.
812
+ * extendSanitizeSchema((s) => {
813
+ * console.log('default sanitize schema:', s);
814
+ * });
815
+ * ```
816
+ *
795
817
  * @remarks Allowing a protocol on `protocols.href` lets the URL through the
796
818
  * SECOND sanitize gate. The FIRST gate (`urlTransform`) must permit the
797
819
  * same protocol independently — see the `urlTransform` prop on
@@ -853,23 +875,6 @@ declare function extendSanitizeSchema(modifier: (draft: SanitizeSchema) => Sanit
853
875
  */
854
876
  declare function useStableValue<T>(value: T): T;
855
877
 
856
- /**
857
- * Builds the `rehype-sanitize` schema used by {@link MarkdownContent}.
858
- *
859
- * Extracted into its own module so the merge logic can be unit-tested in
860
- * isolation without pulling in React or the full markdown pipeline.
861
- *
862
- * @module components/sanitizeSchema
863
- */
864
-
865
- type Schema = typeof defaultSchema;
866
- /**
867
- * The full sanitize schema used by the markdown renderer: extends
868
- * `defaultSchema` to allow `<mark>`, the KaTeX math class names, and the
869
- * three custom hast tags emitted by cross-chunk coordination handlers.
870
- */
871
- declare const sanitizeSchema: Schema;
872
-
873
878
  /**
874
879
  * Cross-chunk shared state. Holds per-chunk contributions (refs, defs,
875
880
  * linkDefs) keyed by Symbol identity allocated via useId reactId, with
@@ -920,45 +925,62 @@ interface ChunkData {
920
925
  ownFootnoteLabels: Set<string>;
921
926
  ownLinkLabels: Set<string>;
922
927
  }
928
+ /**
929
+ * Public, read-only view of the cross-chunk registry. This is the type
930
+ * surfaced by `useDocumentRegistry` and re-exported from the package
931
+ * barrel. Consumers can:
932
+ *
933
+ * - read the registry's current state (`chunkOrder`, `chunkData`,
934
+ * `labelSet`, `version`)
935
+ * - observe changes (`subscribe`)
936
+ * - run selectors (`globalNumber`, `resolveLinkDef`, …)
937
+ *
938
+ * Mutators — `registerChunk`, `allocateSymbol`, `releaseSymbol`,
939
+ * `contributeLabels`, `contributeChunkData` — are intentionally off this
940
+ * interface. Driving the registry directly is reserved for internal
941
+ * coordinators (the package's own `MarkdownContent` renderer) and tests,
942
+ * which import the wider `RegistryInternal` type from this module.
943
+ * `RegistryInternal` is exported here but NOT re-exported from the package
944
+ * barrel — keeping mutators off the public surface prevents a misbehaving
945
+ * consumer-component from corrupting refcounts, skipping version bumps, or
946
+ * otherwise breaking the invariants the renderer relies on.
947
+ */
923
948
  interface Registry {
924
- /** Chunk mount-order Symbol list. **Read-only from outside the registry.**
925
- * Direct mutation (`.push`, `.splice`, index assignment) corrupts
926
- * footnote numbering, "last chunk" detection, and eviction. Use the
927
- * `allocateSymbol` / `releaseSymbol` / `registerChunk` API instead. */
949
+ /** Chunk mount-order Symbol list. **Read-only.** Direct mutation
950
+ * (`.push`, `.splice`, index assignment) corrupts footnote numbering,
951
+ * "last chunk" detection, and eviction. */
928
952
  readonly chunkOrder: readonly symbol[];
929
- /** Chunk Symbol → contribution payload. **Read-only from outside.**
930
- * Use `contributeChunkData` / `contributeLabels` / `registerChunk` to
931
- * publish; direct `.set` / `.delete` bypasses version bumps and
932
- * subscriber wake-ups. */
953
+ /** Chunk Symbol → contribution payload. **Read-only.** Direct `.set` /
954
+ * `.delete` bypasses version bumps and subscriber wake-ups. */
933
955
  readonly chunkData: ReadonlyMap<symbol, ChunkData>;
934
956
  /** Union of own-def labels across all chunks. PASS 0.5 phantom-injection
935
- * driver. **Read-only from outside.** The registry derives this from
936
- * per-chunk contributions; direct mutation breaks the derivation. */
957
+ * driver. **Read-only.** The registry derives this from per-chunk
958
+ * contributions; direct mutation breaks the derivation. */
937
959
  readonly labelSet: {
938
960
  readonly footnoteLabels: ReadonlySet<string>;
939
961
  readonly linkLabels: ReadonlySet<string>;
940
962
  };
941
- /** Monotonic version counter bumped by every mutation. **Read-only from
942
- * outside** — consumers should observe via `subscribe`, not by writing. */
963
+ /** Monotonic version counter bumped by every mutation. **Read-only**
964
+ * consumers should observe via `subscribe`, not by writing. */
943
965
  readonly version: number;
944
- /** Allocate (or reuse, for Strict Mode remount) the chunk Symbol for
945
- * `reactId` AND publish this chunk's own def labels (footnotes + links)
946
- * in one call. Canonical pair API used by `MarkdownContent`'s allocate
947
- * effect — combining the two reduces the pair to a single registry
948
- * version step, which downstream consumers see as one wake-up rather
949
- * than two (the second was already coalesced by microtask, but this
950
- * keeps the version monotonic-by-1-per-mount which makes debugging
951
- * easier). The granular `allocateSymbol` / `contributeLabels` methods
952
- * remain available for tests that need to exercise each step. */
953
- registerChunk(reactId: string, footnotes: Set<string>, links: Set<string>): symbol;
954
- allocateSymbol(reactId: string): symbol;
955
- releaseSymbol(reactId: string): void;
956
- contributeLabels(symbol: symbol, footnotes: Set<string>, links: Set<string>): void;
957
- contributeChunkData(symbol: symbol, data: ChunkData): void;
958
966
  subscribe(cb: () => void): () => void;
959
967
  canonicalFootnoteFor(label: string): symbol | null;
960
968
  canonicalLinkFor(label: string): symbol | null;
961
969
  globalNumber(label: string): number | null;
970
+ /**
971
+ * Resolve a cross-chunk link definition by label. The returned `url` is the
972
+ * value the contributing chunk's `urlTransform` produced — cross-chunk
973
+ * link/image references run a second, per-attribute sanitization pass
974
+ * (`urlTransform` + `sanitizeSchema.protocols`) at render time, so the
975
+ * placeholder components themselves never trust this value blindly.
976
+ *
977
+ * Consumers reading `def.url` directly (custom backlink panels, analytics,
978
+ * dev tooling) receive a defense-in-depth-filtered string but should still
979
+ * pipe it through their own `urlTransform` if they intend to render it as
980
+ * an `href`/`src` — the contribute-time pass uses the `'href'` key and a
981
+ * synthetic `<a>` node, so a key-aware policy may treat the value
982
+ * differently when used as an `<img src>`.
983
+ */
962
984
  resolveLinkDef(label: string): LinkDef | null;
963
985
  getRefsForLabel(label: string): number;
964
986
  /** Map a chunk-local footnote-ref occurrence index (1-based, as emitted by
@@ -1110,8 +1132,8 @@ interface AIMarkdownProps<TConfig extends AIMarkdownRenderConfig = AIMarkdownRen
1110
1132
  *
1111
1133
  * Allowing a protocol here is necessary but **not sufficient** to render
1112
1134
  * a link — the second gate (`rehype-sanitize`) also enforces its own
1113
- * protocol allowlist. See the {@link sanitizeSchema} prop and the
1114
- * matching {@link extendSanitizeSchema} helper for the second gate.
1135
+ * protocol allowlist. See the `sanitizeSchema` prop on this component
1136
+ * and the {@link extendSanitizeSchema} helper for the second gate.
1115
1137
  *
1116
1138
  * **API stability**: the `UrlTransform` type tracks the upstream
1117
1139
  * `react-markdown` shape and may change with its major versions.
@@ -1119,10 +1141,11 @@ interface AIMarkdownProps<TConfig extends AIMarkdownRenderConfig = AIMarkdownRen
1119
1141
  urlTransform?: UrlTransform | null;
1120
1142
  /**
1121
1143
  * Override the `rehype-sanitize` schema applied to the rendered output.
1122
- * The library default ({@link sanitizeSchema}) extends `rehype-sanitize`'s
1123
- * own `defaultSchema` with the `<mark>` tag, KaTeX class names, and the
1124
- * cross-chunk coordination tags (`cross-chunk-link`, `cross-chunk-image`,
1125
- * `footnote-sup`).
1144
+ * The library default extends `rehype-sanitize`'s own `defaultSchema`
1145
+ * with the `<mark>` tag, KaTeX class names, and the cross-chunk
1146
+ * coordination tags (`cross-chunk-link`, `cross-chunk-image`,
1147
+ * `footnote-sup`). The default is not exported as a value — see
1148
+ * {@link extendSanitizeSchema} for how to inspect or extend it safely.
1126
1149
  *
1127
1150
  * **Recommended pattern**: build the schema with {@link extendSanitizeSchema}
1128
1151
  * (mutate-and-return form) so those library additions stay intact, and
@@ -1147,10 +1170,11 @@ interface AIMarkdownProps<TConfig extends AIMarkdownRenderConfig = AIMarkdownRen
1147
1170
  * lose its placeholders. Prefer the helper unless you have a specific
1148
1171
  * reason to opt out.
1149
1172
  *
1150
- * **Reference stability matters.** Inline `<AIMarkdown sanitizeSchema={{
1151
- * ...sanitizeSchema, protocols: {...} }}>` is mitigated by an internal
1152
- * `useStableValue` deep-equal pass, but the safer pattern is still
1153
- * module-scope. Development builds will `console.warn` on identity flips.
1173
+ * **Reference stability matters.** An inline call
1174
+ * (`sanitizeSchema={extendSanitizeSchema((s) => { })}`) is mitigated by
1175
+ * an internal `useStableValue` deep-equal pass, but the safer pattern is
1176
+ * still module-scope. Development builds will `console.warn` on identity
1177
+ * flips.
1154
1178
  *
1155
1179
  * **API stability**: the `SanitizeSchema` type tracks the upstream
1156
1180
  * `rehype-sanitize` shape and may change with its major versions.
@@ -1164,4 +1188,4 @@ interface AIMarkdownProps<TConfig extends AIMarkdownRenderConfig = AIMarkdownRen
1164
1188
  declare const AIMarkdownComponent: <TConfig extends AIMarkdownRenderConfig = AIMarkdownRenderConfig, TRenderData extends AIMarkdownMetadata = AIMarkdownMetadata>({ streaming, content, fontSize, contentPreprocessors, customComponents, defaultConfig, config, metadata, Typography, ExtraStyles, variant, colorScheme, documentId, urlTransform, sanitizeSchema, }: AIMarkdownProps<TConfig, TRenderData>) => react_jsx_runtime.JSX.Element;
1165
1189
  declare const _default: typeof AIMarkdownComponent;
1166
1190
 
1167
- export { type AIMDContentPreprocessor, type AIMarkdownColorScheme, type AIMarkdownCustomComponents, AIMarkdownDocuments, type AIMarkdownDocumentsProps, type AIMarkdownExtraStylesComponent, type AIMarkdownExtraStylesProps, type AIMarkdownMetadata, type AIMarkdownProps, type AIMarkdownRenderConfig, AIMarkdownRenderDisplayOptimizeAbility, AIMarkdownRenderExtraSyntax, type AIMarkdownRenderState, type AIMarkdownTypographyComponent, type AIMarkdownTypographyProps, type AIMarkdownVariant, type ChunkData, type FootnoteDef, type LinkDef, type PartialDeep, type RefKind, type RefRecord, type Registry, type SanitizeSchema, type UrlTransform, _default as default, defaultAIMarkdownRenderConfig, defaultUrlTransform, extendSanitizeSchema, sanitizeSchema, useAIMarkdownMetadata, useAIMarkdownRenderState, useDocumentRegistry, useStableValue };
1191
+ export { type AIMDContentPreprocessor, type AIMarkdownColorScheme, type AIMarkdownCustomComponents, AIMarkdownDocuments, type AIMarkdownDocumentsProps, type AIMarkdownExtraStylesComponent, type AIMarkdownExtraStylesProps, type AIMarkdownMetadata, type AIMarkdownProps, type AIMarkdownRenderConfig, AIMarkdownRenderDisplayOptimizeAbility, AIMarkdownRenderExtraSyntax, type AIMarkdownRenderState, type AIMarkdownTypographyComponent, type AIMarkdownTypographyProps, type AIMarkdownVariant, type ChunkData, type FootnoteDef, type LinkDef, type PartialDeep, type RefKind, type RefRecord, type Registry, type SanitizeSchema, type UrlTransform, _default as default, defaultAIMarkdownRenderConfig, defaultUrlTransform, extendSanitizeSchema, useAIMarkdownMetadata, useAIMarkdownRenderState, useDocumentRegistry, useStableValue };