> ## Documentation Index
> Fetch the complete documentation index at: https://docs.guild.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Message formatting

> How the session interface renders markdown, math, diagrams, and code in agent responses.

The session interface renders agent output using [Streamdown](https://github.com/nicolo-ribaudo/streamdown), a streaming Markdown renderer. Streamdown replaces the previous `react-markdown` engine and adds support for math expressions, Mermaid diagrams, and theme-accurate syntax highlighting via Shiki.

## Markdown

Standard Markdown renders in session messages: headings, bold, italic, tables, lists, links, blockquotes, and inline code. Agents can return any valid Markdown and the session view formats it automatically.

## Math expressions

Write math in standard LaTeX notation using KaTeX delimiters. The session interface renders it with [KaTeX](https://katex.org).

Wrap inline expressions in single dollar signs (`$...$`):

```text theme={null}
The area of a circle is $A = \pi r^2$.
```

Wrap block (display) expressions in double dollar signs (`$$...$$`):

```text theme={null}
$$
\sum_{i=1}^{n} i = \frac{n(n+1)}{2}
$$
```

## Diagrams

The session interface renders [Mermaid](https://mermaid.js.org) diagrams inline via `@streamdown/mermaid`. Use a fenced code block with the `mermaid` language tag:

````text theme={null}
```mermaid
flowchart TD
    A[Start] --> B{Condition}
    B -- Yes --> C[Branch A]
    B -- No  --> D[Branch B]
```
````

The diagram renders inline in the session view.

## Code blocks

Code blocks use [Shiki](https://shiki.style) for syntax highlighting. Shiki applies theme-accurate colors for over 100 languages. Specify the language after the opening fence:

```typescript theme={null}
function greet(name: string): string {
  return `Hello, ${name}!`
}
```

Supported languages include `typescript`, `javascript`, `python`, `bash`, `json`, `yaml`, `sql`, and many others.
