![Logo](assets/logo-light.png) ![Logo](assets/logo-dark.png)

Python bindings to cmark: CommonMark parsing and rendering (HTML, LaTeX, man, XML, CommonMark, plaintext)

Fast Python bindings to [cmark-gfm](https://github.com/github/cmark-gfm), the C reference implementation of CommonMark with GitHub Flavored Markdown extensions. Render Markdown to six output formats from a single, lightweight package.

### Install and Go

``` bash
pip install multimark
```

Wheels are available for Linux, macOS, and Windows (Python 3.9+). No system dependencies required.

``` python
from multimark import markdown_to_html

markdown_to_html("**Hello**, *world*!")
# '<p><strong>Hello</strong>, <em>world</em>!</p>\n'
```

### Six Output Formats

| Function | Output |
|----|----|
| [markdown_to_html()](./reference/markdown_to_html.md#multimark.markdown_to_html) | HTML |
| [markdown_to_latex()](./reference/markdown_to_latex.md#multimark.markdown_to_latex) | LaTeX |
| [markdown_to_man()](./reference/markdown_to_man.md#multimark.markdown_to_man) | groff man page |
| [markdown_to_commonmark()](./reference/markdown_to_commonmark.md#multimark.markdown_to_commonmark) | Normalized CommonMark |
| [markdown_to_xml()](./reference/markdown_to_xml.md#multimark.markdown_to_xml) | XML (AST) |
| [markdown_to_plaintext()](./reference/markdown_to_plaintext.md#multimark.markdown_to_plaintext) | Readable plain text |

Every renderer shares the same interface: pass a Markdown string, get formatted output back. No intermediate objects, no setup.

### GitHub Flavored Markdown Built In

Enable tables, strikethrough, autolinks, task lists, and tag filtering with a single argument:

``` python
from multimark import markdown_to_html

markdown_to_html(
    "| A | B |\n|---|---|\n| 1 | 2 |\n",
    extensions=["table"],
)
```

### Safe by Default

The HTML renderer strips raw HTML unless you explicitly opt in with `unsafe=True`. The plaintext renderer always omits raw HTML. Smart punctuation, source position mapping, footnotes, and line wrapping are all one keyword argument away.

``` python
markdown_to_html('"Hello" -- world...', smart=True)
# '<p>\u201cHello\u201d \u2013 world\u2026</p>\n'
```

[📖 User Guide Installation, quick start, extensions, output formats, options, and recipes. →](user-guide/introduction.md) [⚙️ API Reference Full documentation for every renderer, option flag, and utility function. →](reference/index.md)
