LinuxCommandLibrary

cmark

CommonMark Markdown parser and renderer

TLDR

Convert Markdown to HTML

$ cmark [input.md]
copy
Convert to specific format
$ cmark --to [html|xml|man|latex] [input.md]
copy
Read from stdin
$ cat [input.md] | cmark
copy
Output to file
$ cmark [input.md] > [output.html]
copy
Enable smart typography
$ cmark --smart [input.md]
copy
Validate and show AST
$ cmark --validate-utf8 [input.md]
copy

SYNOPSIS

cmark [options] [file...]

DESCRIPTION

cmark is the reference C implementation of CommonMark, a strongly specified and highly compatible variant of Markdown. It parses Markdown input and converts it to various output formats including HTML, XML, groff man pages, CommonMark, and LaTeX.
The parser is designed for correctness and performance, strictly following the CommonMark specification to eliminate the ambiguities present in the original Markdown description. This makes it suitable for applications that require predictable, consistent rendering across different tools.
cmark reads from files or standard input and writes to standard output, making it easy to integrate into pipelines. The --smart option provides typographic enhancements like curly quotes and em-dashes, while --safe strips potentially dangerous raw HTML from input.

PARAMETERS

--to format

Output format: html, xml, man, commonmark, latex.
--smart
Enable smart punctuation (curly quotes, dashes).
--safe
Omit raw HTML and potentially unsafe links.
--validate-utf8
Validate UTF-8 and replace invalid sequences.
--hardbreaks
Render soft breaks as hard breaks.

SEE ALSO

pandoc(1), markdown(1), grip(1)

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community