e30e75b5d4
Changesets / Create Version PR (push) Has been cancelled
Deploy Shadcn Registry / Deploy Production (push) Has been cancelled
Template Metrics / LOC + Bundle Size (push) Has been cancelled
Code Quality / Oxlint + Oxfmt (push) Has been cancelled
Code Quality / Template Sync (push) Has been cancelled
Code Quality / Build Changed Packages (push) Has been cancelled
Code Quality / Test Changed Packages (push) Has been cancelled
Deploy Expo Example / Deploy Production (push) Has been cancelled
Deploy Ink Example / Deploy Production (push) Has been cancelled
Python Tests / pytest (assistant-stream, 3.10) (push) Has been cancelled
Python Tests / pytest (assistant-stream, 3.12) (push) Has been cancelled
Python Tests / pytest (assistant-ui-sync-server-api, 3.10) (push) Has been cancelled
Python Tests / pytest (assistant-ui-sync-server-api, 3.12) (push) Has been cancelled
29 lines
1.0 KiB
Markdown
29 lines
1.0 KiB
Markdown
# `@assistant-ui/react-ink-markdown`
|
|
|
|
Terminal markdown rendering for [`@assistant-ui/react-ink`](https://www.npmjs.com/package/@assistant-ui/react-ink). Wraps [`markdansi`](https://github.com/steipete/Markdansi) to render formatted headings, code blocks, tables, lists, and more in the terminal, with Shiki syntax highlighting.
|
|
|
|
## Installation
|
|
|
|
```bash
|
|
npm install @assistant-ui/react-ink @assistant-ui/react-ink-markdown ink react shiki
|
|
```
|
|
|
|
## Usage
|
|
|
|
Inside `MessagePrimitive.Parts`, use `MarkdownTextPrimitive` to read text and status from the runtime context automatically:
|
|
|
|
```tsx
|
|
import { MessagePrimitive } from "@assistant-ui/react-ink";
|
|
import { MarkdownTextPrimitive } from "@assistant-ui/react-ink-markdown";
|
|
|
|
<MessagePrimitive.Parts>
|
|
{({ part }) => (part.type === "text" ? <MarkdownTextPrimitive /> : null)}
|
|
</MessagePrimitive.Parts>;
|
|
```
|
|
|
|
For standalone use or to attach a custom Shiki highlighter, see the Documentation section below.
|
|
|
|
## Documentation
|
|
|
|
Full reference at [assistant-ui.com/docs/ink](https://www.assistant-ui.com/docs/ink).
|