Skip to content

Commit 77fdd8a

Browse files
authored
Refresh chat install and markdown docs
Update chat docs so the AG-UI install path includes required protocol packages, and clarify that marked is the supported required markdown peer while the plain-text path is only a runtime fallback.
1 parent d6f1726 commit 77fdd8a

2 files changed

Lines changed: 9 additions & 10 deletions

File tree

apps/website/content/docs/chat/getting-started/installation.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@ Install `@threadplane/chat`, your chosen runtime adapter, and the `marked` markd
3636
npm install @threadplane/chat @threadplane/langgraph marked
3737

3838
# AG-UI compatible backends
39-
npm install @threadplane/chat @threadplane/ag-ui marked
39+
npm install @threadplane/chat @threadplane/ag-ui @ag-ui/client @ag-ui/core marked
4040
```
4141

42-
`marked` is a required peer dependency used to render assistant message markdown (code blocks, tables, headings). The chat components ship with their own design tokens and component-scoped styles — no Tailwind, PostCSS, or global stylesheet import is required.
42+
`marked` is a required peer dependency used to render assistant message markdown (code blocks, tables, headings). The AG-UI adapter also needs the protocol packages `@ag-ui/client` and `@ag-ui/core`. The chat components ship with their own design tokens and component-scoped styles — no Tailwind, PostCSS, or global stylesheet import is required.
4343

4444
<Callout type="info" title="Full peer dependency list">
4545
`@threadplane/chat` declares peers on `@angular/core`, `@angular/common`, `@angular/platform-browser`, `@angular/router` (all `^20.0.0 || ^21.0.0`), plus `@threadplane/licensing`, `@threadplane/render`, `@threadplane/a2ui`, `@json-render/core` (`^0.16.0`), `@langchain/core` (`^1.1.33`), `rxjs` (`~7.8.0`), `marked` (`^15 || ^16`), `zod` (`^3.25.0`), and optional `katex` (`^0.16.0 || ^0.17.0`). npm 7+ installs all required peers automatically.

apps/website/content/docs/chat/guides/markdown.mdx

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ AI messages in `@threadplane/chat` can render full markdown -- headings, code bl
77
The markdown pipeline has two stages:
88

99
1. **Streaming renderer**: `<chat-streaming-md>` parses markdown into node keys and renders those keys through `cacheplaneMarkdownViews`.
10-
2. **Sanitized HTML helper**: `renderMarkdown()` converts markdown text to sanitized HTML using `marked` when it is installed, falling back to escaped plain text with `<br>` newline conversion.
10+
2. **Sanitized HTML helper**: `renderMarkdown()` converts markdown text to sanitized HTML using the required `marked` peer dependency. If `marked` cannot be loaded at runtime, it falls back to escaped plain text with `<br>` newline conversion.
1111

1212
## The renderMarkdown() Function
1313

@@ -37,8 +37,8 @@ function renderMarkdown(content: string, sanitizer: DomSanitizer): SafeHtml
3737
**Returns:** `SafeHtml` -- sanitized HTML that can be bound via `[innerHTML]`.
3838

3939
**Behavior:**
40-
- When `marked` is installed, parses markdown to HTML, sanitizes it through Angular's `SecurityContext.HTML`, then marks the result as trusted.
41-
- When `marked` is not available, escapes HTML entities (`&`, `<`, `>`) and converts newlines to `<br>` tags.
40+
- Parses markdown to HTML with `marked`, sanitizes it through Angular's `SecurityContext.HTML`, then marks the result as trusted.
41+
- If the dynamic `marked` import fails at runtime, escapes HTML entities (`&`, `<`, `>`) and converts newlines to `<br>` tags as a defensive fallback.
4242

4343
<Callout type="info" title="Dynamic import">
4444
The `marked` library is loaded via a dynamic `import('marked')` at module initialization time. This means it does not block initial bundle loading and resolves before the first render in most cases.
@@ -199,13 +199,12 @@ The most common mistake is providing `'code'` as an override key — it does not
199199

200200
All built-in markdown view components consume the same `--tplane-chat-*` and `--a2ui-*` CSS custom properties as the rest of the chat UI. No extra tokens are neededchanging the active theme automatically re-styles markdown output. See the [chat theming guide](/docs/chat/guides/theming) for the full token reference.
201201

202-
## Without marked
202+
## Defensive Plain-Text Fallback
203203

204-
If you skip installing `marked`, markdown content renders as plain text with line breaks preserved. That's fine for simple chat apps that don't need rich formatting.
204+
`marked` is a required peer dependency for supported `@threadplane/chat` installs:
205205

206206
```bash
207-
# Full markdown support:
208207
npm install marked
209-
210-
# Or skip it -- plain text fallback works automatically
211208
```
209+
210+
If the dynamic `import('marked')` still fails at runtime, `renderMarkdown()` falls back to escaped plain text with line breaks preserved. Treat that fallback as a resilience path, not as the recommended installation mode; the built-in chat experience expects `marked` to be present for rich markdown.

0 commit comments

Comments
 (0)