@ai-react-markdown/core 1.4.4 → 1.4.5
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 +28 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js.map +1 -1
- package/dist/typography/all.css +34 -29
- package/dist/typography/all.css.map +1 -1
- package/dist/typography/default.css +34 -29
- package/dist/typography/default.css.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -391,6 +391,32 @@ Import the corresponding CSS to activate styles:
|
|
|
391
391
|
import '@ai-react-markdown/core/typography/default.css';
|
|
392
392
|
```
|
|
393
393
|
|
|
394
|
+
#### Customization tokens
|
|
395
|
+
|
|
396
|
+
All `default`-variant styles are driven by CSS custom properties declared on `.aim-typography-root.default`. Spacing, font-size, and heading tokens are **anchored to `--aim-font-size-root`** (injected by the renderer from the `fontSize` prop), so changing `fontSize` proportionally scales every dimension. To customize, override any token in your own stylesheet:
|
|
397
|
+
|
|
398
|
+
```css
|
|
399
|
+
.aim-typography-root.default {
|
|
400
|
+
--aim-spacing-md: calc(var(--aim-font-size-root) * 1.2); /* roomier paragraphs */
|
|
401
|
+
--aim-h1-font-size: calc(var(--aim-font-size-root) * 2.5); /* bigger H1 */
|
|
402
|
+
--aim-font-weight-strong: 600; /* lighter headings + th */
|
|
403
|
+
--aim-color-anchor: #ff6b6b; /* red links */
|
|
404
|
+
}
|
|
405
|
+
```
|
|
406
|
+
|
|
407
|
+
| Group | Tokens | Notes |
|
|
408
|
+
| ------------- | ------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
409
|
+
| Spacing | `--aim-spacing-{xs,sm,md,lg,xl}` | `calc(var(--aim-font-size-root) * k)` where `k ∈ {0.625, 0.75, 1, 1.25, 1.5}` |
|
|
410
|
+
| Font size | `--aim-font-size-{xs,sm,md,lg,xl}` | `k ∈ {0.75, 0.875, 1, 1.125, 1.25}` |
|
|
411
|
+
| Heading sizes | `--aim-h{1..6}-font-size` | Multipliers mirror Mantine's heading scale (`{2.125, 1.625, 1.375, 1.125, 1, 0.875}`) |
|
|
412
|
+
| Heading meta | `--aim-h{1..6}-line-height`, `--aim-h{1..6}-font-weight` | line-heights are unitless; weights default to `var(--aim-font-weight-strong)` |
|
|
413
|
+
| Weight | `--aim-font-weight-strong` | Shared by all headings and `<th>`. Default `700`. |
|
|
414
|
+
| KaTeX | `--aim-katex-font-size` | Defaults to `var(--aim-font-size-root)`, so formulas stay at the component-root size regardless of parent context (blockquote, heading). Override to `1em` if you want parent-relative. |
|
|
415
|
+
| Misc | `--aim-line-height`, `--aim-radius-sm`, `--aim-font-family-{monospace,headings}` | Unitless / rem / font-stack constants. |
|
|
416
|
+
| Color (light) | `--aim-color-{text,dimmed,anchor,border,code-bg,code-text,blockquote-bg,mark-bg,mark-text}` | Declared on `.aim-typography-root.light`; dark variants on `.aim-typography-root.dark`. |
|
|
417
|
+
|
|
418
|
+
> **Stability contract:** the _names_ and _roles_ of these tokens follow semver. The exact default _values_ (multipliers, colors) may shift under minor bumps as the visual design evolves — override the token if you need a specific value to be locked.
|
|
419
|
+
|
|
394
420
|
### Custom Typography Component
|
|
395
421
|
|
|
396
422
|
Replace the typography wrapper by passing a custom component. The `style` prop carries CSS custom properties injected by the core renderer — **merge it onto your root element** so that descendant CSS can reference these variables:
|
|
@@ -419,6 +445,8 @@ The core renderer injects the following CSS custom properties via the Typography
|
|
|
419
445
|
|
|
420
446
|
**Why `--aim-font-size-root`?** Markdown content frequently nests elements that use relative `em` units — blockquotes, lists, code blocks. Each nesting level compounds the effective size: a `0.875em` code span inside a `1.125em` blockquote resolves to `0.984em` of the parent, not `0.875em` of the root. This variable provides a stable, absolute reference that inner CSS rules can use to opt out of compounding when a fixed size is needed.
|
|
421
447
|
|
|
448
|
+
The built-in `default` variant already consumes this variable — all of its spacing, font-size, and heading tokens are defined as `calc(var(--aim-font-size-root) * k)`, so changing the `fontSize` prop on `<AIMarkdown>` proportionally scales every rendered dimension. See [Customization tokens](#customization-tokens) above for the full surface.
|
|
449
|
+
|
|
422
450
|
### Extra Styles Wrapper
|
|
423
451
|
|
|
424
452
|
The `ExtraStyles` prop accepts a component rendered between the typography wrapper and the markdown content. Useful for injecting additional CSS scope or theme providers:
|