#ansi-term #render-markdown #terminal #markdown

markdown-to-ansi

Render Markdown as ANSI-formatted terminal text

5 releases

Uses new Rust 2024

0.2.1 Feb 28, 2026
0.2.0 Feb 23, 2026
0.1.2 Feb 23, 2026
0.1.1 Feb 22, 2026
0.1.0 Feb 21, 2026

#1983 in Text processing

Download history 25/week @ 2026-02-16 70/week @ 2026-02-23 15/week @ 2026-03-02 11/week @ 2026-03-09 40/week @ 2026-03-16 55/week @ 2026-03-23 58/week @ 2026-03-30 84/week @ 2026-04-06

240 downloads per month
Used in 6 crates (3 directly)

Apache-2.0

285KB
1K SLoC

markdown-to-ansi

Crates.io docs.rs CI License

Render Markdown as ANSI-formatted terminal text

Converts CommonMark Markdown into richly formatted ANSI terminal output. Powered by pulldown-cmark for parsing and syntect for syntax highlighting (base16-ocean.dark theme).

Supported elements

  • Headings (bold)
  • Bold, italic, and inline code (colored)
  • Links rendered as clickable OSC 8 terminal hyperlinks
  • Fenced code blocks with syntax highlighting and background padding
  • Tables with Unicode box-drawing borders, alignment, and bold headers
  • Ordered and unordered lists with nested indentation
  • Text wrapping that respects terminal width and preserves ANSI escapes

API

  • render(text, opts) -- full block-level rendering (paragraphs, headings, code blocks, lists, tables)
  • render_inline(text, opts) -- inline-only rendering (bold, italic, code spans, links)
  • has_syntax(lang) -- check if a language token has a syntax definition

Usage

use markdown_to_ansi::{render, render_inline, Options};

let opts = Options {
    syntax_highlight: true,
    width: Some(80),
    code_bg: true,
};

// Full document rendering
let output = render("# Hello

This is **bold**.", &opts);
println!("{output}");

// Inline-only rendering (no paragraph wrappers)
let inline = render_inline("Use `foo` for **bar**", &opts);
println!("{inline}");

License

Apache-2.0

Dependencies

~4.5–8MB
~137K SLoC