Toolforge Docs
DocsBlock Outputstext

text

Display rich text content using Markdown formatting.

Usage

Text

const content = block.text({
  content: `
# Welcome

This is a **bold** statement with *emphasis*.

- Item 1
- Item 2
- Item 3
  `,
})

Props

PropDescriptionTypeRequiredDefault
titleTitle displayed above the textstringNoundefined
descriptionDescription text below the titlestringNoundefined
contentMarkdown content to renderstringYes

Returns

Returns a text block that can be returned from a handler or passed to io.message().

Markdown Support

The text block supports standard Markdown syntax:

  • Headings: #, ##, ###, etc.
  • Bold: **text** or __text__
  • Italic: *text* or _text_
  • Links: [text](url)
  • Lists: - or * for unordered, 1. for ordered
  • Code: `inline` or fenced code blocks
  • Blockquotes: > text
  • Tables: Standard Markdown tables
  • Horizontal rules: ---

Examples

Basic formatted text

Formatted text

return block.text({
  content: `
Here's some **important** information:

1. First step
2. Second step
3. Third step

For more details, see the [documentation](https://docs.example.com).
  `,
})

With title

With title

return block.text({
  content: `
## New Features

- Added dark mode support
- Improved search performance
- New dashboard widgets

## Bug Fixes

- Fixed login timeout issue
- Resolved date formatting problems
  `,
})

Code examples

With title

return block.text({
  content: `
To authenticate, include the API key in your headers:

\`\`\`bash
curl -H "Authorization: Bearer YOUR_API_KEY" \\
  https://api.example.com/users
\`\`\`

Or in code:

\`\`\`typescript
const response = await fetch('/api/users', {
  headers: {
    'Authorization': \`Bearer \${apiKey}\`,
  },
})
\`\`\`
  `,
})

Tables in text

Tables in text

return block.text({
  content: `
| Plan | Users | Price |
|------|-------|-------|
| Free | 5 | $0/mo |
| Pro | 25 | $29/mo |
| Team | 100 | $99/mo |
| Enterprise | Unlimited | Contact us |
  `,
})

Status report

status report

return block.text({
  content: `
## Summary

Today's deployment was **successful**. All services are running normally.

### Key Metrics

- Uptime: 99.99%
- Response time: 45ms avg
- Error rate: 0.01%

### Notes

> The scheduled maintenance window has been moved to next Tuesday.

---

*Report generated at ${new Date().toISOString()}*
  `,
})

Inline with layout

status report

return block.layout({
  columns: 12,
  children: [
    {
      element: block.text({
        content: `
1. Select a file
2. Configure options
3. Click submit
        `,
      }),
      colSpan: 6,
    },
    {
      element: block.text({
        content: `
- Maximum file size: 10MB
- Supported formats: CSV, JSON
- Processing time: ~30 seconds
        `,
      }),
      colSpan: 6,
    },
  ],
})

Dynamic content

Dynamic content

const results = await analyzeData(data)

return block.text({
  content: `
## Summary

Analyzed **${results.total}** records.

### Findings

${results.findings.map((f) => `- ${f}`).join('\n')}

### Recommendations

${results.recommendations.map((r, i) => `${i + 1}. ${r}`).join('\n')}
  `,
})

On this page