🎨 Markdansi: Wraps, colors, links—no baggage.
<p align="center" <img src="./markdansi.png" alt="Markdansi README header" width="1100" </p
Tiny, dependency-light Markdown → ANSI renderer and CLI for modern Node (=22). Focuses on readable terminal output with sensible wrapping, GFM support (tables, task lists, strikethrough), optional OSC‑8 hyperlinks, and zero built‑in syntax highlighting (pluggable hook). Written in TypeScript, ships ESM.
Published on npm as markdansi.
Install
Grab it from npm; no native deps, so install is instant on Node 22+.
bun add markdansi
# or
pnpm add markdansi
# or
npm install markdansiCLI
Quick one-shot renderer: pipe Markdown in, ANSI comes out. Flags let you pick width, wrap, colors, links, and table/list styling.
markdansi [FILE] [--in FILE] [--out FILE] [--width N] [--no-wrap] [--no-color] [--no-links] [--theme default|dim|bright|solarized|monochrome|contrast]
[--list-indent N] [--quote-prefix STR]- Input: positional FILE, --in FILE, or stdin when neither is given (use --in - for stdin explicitly).
- Output: stdout unless --out provided.
- Wrapping: on by default; --no-wrap disables hard wrapping.
- Links: OSC‑8 when supported; --no-links disables.
- Lists/quotes: --list-indent sets spaces per nesting level (default 2); --quote-prefix sets blockquote prefix (default │ ).
Library
Use the renderer directly in Node/TS for customizable theming, optional syntax highlighting hooks, and OSC‑8 link control.
ESM / CommonJS
Markdansi ships ESM ("type":"module"). If you’re in CommonJS (or a tool like tsx running your script as CJS), prefer dynamic import:
const { render } = await import("markdansi");
console.log(render("# hello"));Streaming (recommended: hybrid blocks)
If you’re streaming Markdown (LLM output), keep scrollback safe by emitting completed fragments only and writing them once (append-only; no in-place redraw).