| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
CommonMark Markdown to ANSI-escaped terminal output
Marcli converts Markdown into styled terminal text using ANSI escape sequences. It parses via comrak and renders headings, lists, code blocks, inline formatting, links, images, and more as richly styled output for terminal emulators.
Syntax highlighting for fenced code blocks is provided by syntect.
This is a Rust port of the Elixir marcli library.
Add marcli to your Cargo.toml:
[dependencies]
marcli = "0.1"// Basic rendering
let output = marcli::render("# Hello\n\nSome **bold** text.", &Default::default());
println!("{}", output);
// With CRLF line endings (e.g. for xterm.js)
let opts = marcli::RenderOptions {
newline: "\r\n".into(),
..Default::default()
};
let output = marcli::render(markdown, &opts);Fenced code blocks tagged with a language identifier are automatically syntax-highlighted using ANSI escape sequences via syntect's built-in syntax definitions. No extra configuration is needed.
If no matching syntax definition is found for the specified language, the block renders without highlighting.
Syntax highlighting can be disabled per-theme:
let mut theme = marcli::Theme::default();
theme.syntax_highlight = false;
let opts = marcli::RenderOptions { theme, ..Default::default() };All visual aspects of the output are controlled by the Theme struct. A theme can be loaded from a TOML file:
let theme = marcli::Theme::load(".marcli.toml").unwrap_or_default();
let opts = marcli::RenderOptions { theme, ..Default::default() };
let output = marcli::render(markdown, &opts);Created as part of the Oeditus code quality tooling ecosystem.
MIT
| Back | FazBrowse Home | New Git URL |