@comark/ansi
v0.4.0
Published
ANSI terminal renderer for Comark (Components in Markdown)
Downloads
479
Readme
@comark/ansi
ANSI terminal renderer for Comark. Render markdown as styled terminal output — perfect for CLIs, scripts, and developer tooling.
Features
- 🎨 ANSI-styled output for the terminal
- 🌈 Respects
NO_COLORautomatically - 📐 Configurable terminal width for HR and code blocks
- 🎯 Map any Comark tag to a custom render function
- 🔌 Plugin ecosystem (math, mermaid, highlight, binding…)
- 🎯 Full TypeScript support
Installation
npm install @comark/ansi
# or
pnpm add @comark/ansiUsage
import { render } from '@comark/ansi'
const output = await render(`
# Getting Started
This is a **bold** statement with a [link](https://example.com).
- Item 1
- Item 2
`)
process.stdout.write(output)Options
await render(content, {
colors: true, // emit ANSI escape codes (defaults to true, false when NO_COLOR is set)
width: 80, // terminal width for HR and code block headers
plugins: [],
components: {},
})Syntax highlighting
import { render } from '@comark/ansi'
import highlight from '@comark/ansi/plugins/highlight'
const output = await render('```ts\nconsole.log("hi")\n```', {
plugins: [highlight()],
})Documentation
Full guide and API reference at comark.dev/rendering/ansi.
License
Made with ❤️
Published under MIT License.
