@ai-matrx/rich-content
v0.2.208
Published
The AI Matrx formatted-text engine: the one markdown renderer, streaming markdown, the block splitter and renderer, the generic blocks, <RichContent> levels, the rich-document action registry and menus, copy, and the selection toolbar — as portable React
Readme
@ai-matrx/rich-content
The AI Matrx formatted-text engine as portable React: the one markdown renderer (GFM, math,
directives, wikilinks, mentions, footnotes, streaming heal), the block splitter (static and
streaming), and — as the extraction completes — the block renderer and generic blocks,
<RichContent> levels, the rich-document action registry and menus, copy, and the selection
toolbar. The editor is the sibling package @ai-matrx/rich-content/editor.
Install
pnpm add @ai-matrx/rich-contentPeers: react, react-dom (>= 19). Tailwind consumers add the package's dist to their
content sources (@source "../node_modules/@ai-matrx/rich-content/dist";).
Use
Import modules by path — one specifier is one module, so client/server boundaries and lazy chunks stay intact:
import MarkdownCore from "@ai-matrx/rich-content/markdown-core/MarkdownCore";
import { splitContentIntoBlocksV2 } from "@ai-matrx/rich-content/display/markdown-classification/processors/utils/content-splitter-v2";Host
The engine renders with no host at all. Every capability it can ask for has a default that
announces itself once on the console and marks degraded elements data-rich-content-host="bare".
Configure once at the app root:
import { configureRichContent } from "@ai-matrx/rich-content/host";
configureRichContent({
toast, // your toast (structural: success/error/info/warning/loading/dismiss)
captureError, // your error sink
ErrorActions, // extra actions beside an error message
NestedContent, // nested markdown renderer (standard level)
wikilinks, // { resolve, create, loadBody } against your records
resolvePerson, // @mentions
ResourcePeek, // your record peek
splitterEnvelopes, // content-IR envelope hooks for complete regions
useOpenSaveToTable, // "save these rows as a table"
});| Capability | Default on a bare host |
|---|---|
| toast | the console |
| captureError | console.error |
| ErrorActions | none (the message always shows) |
| NestedContent | the source as plain text |
| wikilinks | every link reads "unavailable" |
| resolvePerson | the mention label as written |
| ResourcePeek | the chip is not clickable |
| splitterEnvelopes | regions carry no metadata.__ir |
| useOpenSaveToTable | no "save as table" button |
MIT licensed.
The editor section
Visual (Tiptap), Source (CodeMirror), Preview, the markdown formatting command layer and edit-in-place — imported as @ai-matrx/rich-content/editor/<core|in-place|format|islands|panels|source|visual|editor>/<module>, stylesheet @ai-matrx/rich-content/editor.css. Render-only imports never load it. See src/editor/README.md.
