# Rendered with NanoMD

Since v1.2.2 the browser dashboard renders agent replies and Markdown files with [NanoMD](https://nanomd.pardn.io), so charts, diagrams and formulas show up as figures instead of source.

## What renders

| Markdown | Result |
| --- | --- |
| ```` ```chartjs ```` with `{"type": ..., "data": {...}}` | Chart: bar, line, pie, doughnut, radar, polarArea, scatter, bubble |
| ```` ```mermaid ```` | Diagram: flowchart, sequenceDiagram, stateDiagram-v2, classDiagram, erDiagram, gantt, timeline |
| ```` ```math ```` or inline `$...$` | KaTeX formula |
| Any other fenced code | Syntax highlighting with a copy button |
| GFM tables, task lists, footnotes, `==highlight==`, `> [!NOTE]` callouts | Styled Markdown |

A block that fails to parse (invalid JSON, unknown chart type, broken Mermaid syntax) shows its source instead. This page is rendered by NanoMD as well:

```chartjs
{"type": "bar", "data": {"labels": ["Q1", "Q2", "Q3", "Q4"], "datasets": [{"label": "Requests (k)", "data": [12, 19, 15, 24]}]}}
```

```mermaid
sequenceDiagram
    Browser->>Daemon: POST /v1/send
    Daemon->>Model: prompt + tools
    Model-->>Daemon: Markdown reply
    Daemon-->>Browser: SSE stream
```

```math
A = P\left(1 + \frac{r}{n}\right)^{nt}
```

## Where it renders

| Surface | Behavior |
| --- | --- |
| Web chat replies and reasoning (`chat-` sessions) | Rendered while streaming; figures in older messages render as they scroll into view |
| `.md`, `.markdown`, `.txt` file links in a reply | Open in the side panel, rendered with NanoMD; local images resolve through `/v1/file/open` |
| TUI, Telegram, Discord | Show the Markdown source |

## How the agent uses it

The system prompt tells the agent where figures render. In `chat-` sessions it adds them to both chat replies and `.md` files; in every other session it puts them only in `.md` files, because those chat surfaces would show the raw block. When content holds numbers across three or more items or time points, a process or a formula, the agent adds the matching chart, diagram or formula next to the table or text it summarizes, without being asked. It skips the figure when it would only restate a single number or a two-item comparison.

## About NanoMD

NanoMD is a TypeScript Markdown parser that turns Markdown into sanitized HTML and a JSON AST, loading Mermaid, KaTeX and Chart.js only when a page uses them. Agenvoy pins its parser and stylesheet in `page/vendor.json` (2.0.10 in v1.2.2); the daemon downloads them once into `~/.config/agenvoy/vendor/nanomd/` and serves them locally, so rendering works offline. Syntax reference and playground: [nanomd.pardn.io](https://nanomd.pardn.io).

See also: [Browser Dashboard](/docs/getting-started-browser).
