# Markdown

> Renders markdown-formatted text with full styling support.

**URL:** https://inference.sh/docs/agents/widgets/markdown
**Last updated:** 2026-09-18

---

Renders markdown-formatted text with full styling support.

## Preview

Renders headers, bold, italic, links, code blocks, lists, and more.

## Usage

```go
node := models.WidgetNode{
    Type:  models.WidgetNodeTypeMarkdown,
    Value: "## Summary\n\nThis is **bold** and this is *italic*.",
}
```

## Props

| Name | Type | Description | Default |
|------|------|-------------|---------|
| `type` | `"markdown"` | Node type | required |
| `value` | `string` | Markdown content | `""` |

## Examples

### Basic Markdown

```go
{
    Type:  models.WidgetNodeTypeMarkdown,
    Value: "Hello **world**!",
}
```

### Rich Content

```go
{
    Type:  models.WidgetNodeTypeMarkdown,
    Value: `## Analysis Results

Here are the key findings:

- **Performance**: 15% improvement
- **Coverage**: 98% test coverage
- **Issues**: 3 minor warnings

\`\`\`json
{
  "status": "success",
  "score": 95
}
\`\`\`
`,
}
```

### Code Snippet

```go
{
    Type:  models.WidgetNodeTypeMarkdown,
    Value: "Install with:\n\n```bash\nnpm install @inference/sdk\n```",
}
```

### Links and Lists

```go
{
    Type:  models.WidgetNodeTypeMarkdown,
    Value: `Check out these resources:

1. [Documentation](https://docs.example.com)
2. [API Reference](https://api.example.com)
3. [Examples](https://github.com/example)
`,
}
```

## Supported Syntax

| Element | Syntax |
|---------|--------|
| Headers | `# H1`, `## H2`, `### H3` |
| Bold | `**bold**` |
| Italic | `*italic*` |
| Code | `` `code` `` |
| Code blocks | ` ```lang ``` ` |
| Links | `[text](url)` |
| Lists | `- item` or `1. item` |
| Blockquotes | `> quote` |

## TypeScript

```typescript
const node: WidgetNode = {
  type: "markdown",
  value: "## Hello\n\nThis is **markdown**.",
}
```

## Best Practices

1. **Use for rich content** - Long-form text, documentation, explanations
2. **Use Text for simple content** - Single-line text without formatting
3. **Escape special characters** - Use backslash for literal `*`, `#`, etc.
4. **Test rendering** - Preview markdown before shipping
