Skip to main content

Crate marcli

Crate marcli 

Source
Expand description

Converts CommonMark Markdown to ANSI-escaped terminal output.

Parses Markdown via comrak and produces strings with ANSI escape sequences suitable for terminal rendering.

§Supported Elements

  • Headings (h1: bold yellow, h2: bold cyan, h3+: bold white)
  • Bold, italic, strikethrough, inline code
  • Bullet lists (triangle markers) and ordered lists (circled numbers)
  • Code blocks with optional language headers (syntax-highlighted via syntect)
  • Block quotes (vertical bar prefix)
  • Thematic breaks (horizontal rules)
  • Links (underlined blue with dimmed URL)
  • Images (bracketed alt text with URL)
  • Task list items (checkbox markers)
  • Tables with box-drawing borders

§Example

let output = marcli::render("# Hello\n\nSome **bold** text.", &Default::default());
assert!(output.contains("Hello"));

Re-exports§

pub use theme::Theme;

Modules§

formatter
Syntax highlighting formatter producing ANSI-escaped terminal output.
theme
Theme configuration for terminal Markdown rendering.

Structs§

RenderOptions
Rendering options.

Functions§

render
Renders a Markdown string as ANSI-escaped terminal output.
strip_ansi
Strip all ANSI escape sequences from text.