Marcli (Marcli v0.3.1)
View SourceConverts CommonMark Markdown to ANSI-escaped terminal output.
Parses Markdown via MDEx 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 when a
makeup_langlexer is available) - 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)
Syntax Highlighting
When a makeup_<lang> lexer library is present (e.g. makeup_elixir,
makeup_erlang, makeup_html), fenced code blocks tagged with a language
identifier are rendered with full ANSI syntax highlighting via
Marcli.Formatter.
Add the desired lexer(s) to your mix.exs dependencies:
{:makeup_elixir, ">= 0.0.0", optional: true}No configuration is required -- the lexer is detected at runtime via
Makeup.Registry. If no matching lexer is loaded, the block is rendered
without highlighting.
Options
:newline-- the line ending to use (default:"\n"). Pass"\r\n"for xterm.js or other terminals that require CRLF.:theme-- aMarcli.Themestruct controlling all visual styles. Defaults toMarcli.Theme.default().
Example
output = Marcli.render("# Hello\n\nSome **bold** text.")
output = Marcli.render(markdown, newline: "\r\n")
theme = Marcli.Theme.load(".marcli.exs")
output = Marcli.render(markdown, theme: theme)
Summary
Functions
Renders a Markdown string as ANSI-escaped terminal output.
Types
@type option() :: {:newline, String.t()} | {:theme, Marcli.Theme.t()} | {:escape_sequences, boolean()}
Functions
Renders a Markdown string as ANSI-escaped terminal output.
Returns a string with embedded ANSI escape sequences. Line endings
default to "\n" but can be overridden with the :newline option.
Options
:newline-- the line ending sequence (default:"\n"):theme-- aMarcli.Themestruct (default:Marcli.Theme.default()):escape_sequences-- whenfalse, strips all ANSI escape sequences from the output (default:true)