@ai-react-markdown/core 1.2.9 → 1.3.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.
- package/README.md +15 -15
- package/dist/index.cjs +1142 -819
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +182 -18
- package/dist/index.d.ts +182 -18
- package/dist/index.js +1214 -891
- package/dist/index.js.map +1 -1
- package/package.json +19 -4
package/README.md
CHANGED
|
@@ -81,20 +81,21 @@ function StreamingChat({ content, isStreaming }: { content: string; isStreaming:
|
|
|
81
81
|
|
|
82
82
|
### `AIMarkdownProps<TConfig, TRenderData>`
|
|
83
83
|
|
|
84
|
-
| Prop | Type | Default | Description
|
|
85
|
-
| ---------------------- | -------------------------------- | ------------------------------- |
|
|
86
|
-
| `content` | `string` | **(required)** | Raw markdown content to render.
|
|
87
|
-
| `streaming` | `boolean` | `false` | Whether content is actively being streamed (e.g. from an LLM).
|
|
88
|
-
| `fontSize` | `number \| string` | `'0.9375rem'` | Base font size. Numbers are treated as pixels.
|
|
89
|
-
| `variant` | `AIMarkdownVariant` | `'default'` | Typography variant name.
|
|
90
|
-
| `colorScheme` | `AIMarkdownColorScheme` | `'light'` | Color scheme name (`'light'`, `'dark'`, or custom).
|
|
91
|
-
| `config` | `PartialDeep<TConfig>` | `undefined` | Partial render config, deep-merged with defaults.
|
|
92
|
-
| `defaultConfig` | `TConfig` | `defaultAIMarkdownRenderConfig` | Base config to merge against. Sub-packages can pass extended defaults.
|
|
93
|
-
| `metadata` | `TRenderData` | `undefined` | Arbitrary data passed to custom components via a dedicated context.
|
|
94
|
-
| `contentPreprocessors` | `AIMDContentPreprocessor[]` | `[]` | Additional preprocessors run after the built-in LaTeX preprocessor.
|
|
95
|
-
| `customComponents` | `AIMarkdownCustomComponents` | `undefined` | `react-markdown` component overrides for specific HTML elements.
|
|
96
|
-
| `Typography` | `AIMarkdownTypographyComponent` | `DefaultTypography` | Typography wrapper component.
|
|
97
|
-
| `ExtraStyles` | `AIMarkdownExtraStylesComponent` | `undefined` | Optional extra style wrapper rendered between typography and content.
|
|
84
|
+
| Prop | Type | Default | Description |
|
|
85
|
+
| ---------------------- | -------------------------------- | ------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
86
|
+
| `content` | `string` | **(required)** | Raw markdown content to render. |
|
|
87
|
+
| `streaming` | `boolean` | `false` | Whether content is actively being streamed (e.g. from an LLM). |
|
|
88
|
+
| `fontSize` | `number \| string` | `'0.9375rem'` | Base font size. Numbers are treated as pixels. |
|
|
89
|
+
| `variant` | `AIMarkdownVariant` | `'default'` | Typography variant name. |
|
|
90
|
+
| `colorScheme` | `AIMarkdownColorScheme` | `'light'` | Color scheme name (`'light'`, `'dark'`, or custom). |
|
|
91
|
+
| `config` | `PartialDeep<TConfig>` | `undefined` | Partial render config, deep-merged with defaults. |
|
|
92
|
+
| `defaultConfig` | `TConfig` | `defaultAIMarkdownRenderConfig` | Base config to merge against. Sub-packages can pass extended defaults. |
|
|
93
|
+
| `metadata` | `TRenderData` | `undefined` | Arbitrary data passed to custom components via a dedicated context. |
|
|
94
|
+
| `contentPreprocessors` | `AIMDContentPreprocessor[]` | `[]` | Additional preprocessors run after the built-in LaTeX preprocessor. |
|
|
95
|
+
| `customComponents` | `AIMarkdownCustomComponents` | `undefined` | `react-markdown` component overrides for specific HTML elements. |
|
|
96
|
+
| `Typography` | `AIMarkdownTypographyComponent` | `DefaultTypography` | Typography wrapper component. |
|
|
97
|
+
| `ExtraStyles` | `AIMarkdownExtraStylesComponent` | `undefined` | Optional extra style wrapper rendered between typography and content. |
|
|
98
|
+
| `documentId` | `string` | auto via `useId()` | Stable id for the _logical markdown document_ this `<AIMarkdown>` is rendering. Used as the id namespace for clobberable attributes (`id`, hash hrefs) so two documents on the same page do not cross-link (footnote `[^1]` in message A won't scroll to `[^1]` in message B). When one document is split into chunks rendered by multiple `<AIMarkdown>` instances, pass the SAME `documentId` to every chunk so prefixes align. The value is passed through `encodeURIComponent` before being injected into HTML attributes, so any string is safe (React's `useId()` output, your own opaque ids, user-supplied UUIDs). |
|
|
98
99
|
|
|
99
100
|
## Configuration
|
|
100
101
|
|
|
@@ -108,7 +109,6 @@ Enable via `config.extraSyntaxSupported`. All are enabled by default.
|
|
|
108
109
|
| --------------------------------------------- | ------------------------------------------------------------------------------------------------------- |
|
|
109
110
|
| `AIMarkdownRenderExtraSyntax.HIGHLIGHT` | `==Highlight==` syntax support |
|
|
110
111
|
| `AIMarkdownRenderExtraSyntax.DEFINITION_LIST` | Definition list syntax ([PHP Markdown Extra](https://michelf.ca/projects/php-markdown/extra/#def-list)) |
|
|
111
|
-
| `AIMarkdownRenderExtraSyntax.SUBSCRIPT` | Superscript (`^text^`) and subscript (`~text~`) |
|
|
112
112
|
|
|
113
113
|
### Display Optimization Abilities
|
|
114
114
|
|