-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.qmd
More file actions
67 lines (51 loc) · 2.16 KB
/
Copy pathindex.qmd
File metadata and controls
67 lines (51 loc) · 2.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
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 five 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'
```
## Five Output Formats
| Function | Output |
|----------|--------|
| `markdown_to_html()` | HTML |
| `markdown_to_latex()` | LaTeX |
| `markdown_to_man()` | groff man page |
| `markdown_to_commonmark()` | Normalized CommonMark |
| `markdown_to_xml()` | XML (AST) |
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
Raw HTML is stripped from output unless you explicitly opt in with `unsafe=True`. 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'
```
```{=html}
<div class="gd-cta-grid">
<a href="user-guide/introduction.html" class="gd-cta-card">
<span class="gd-cta-icon">📖</span>
<span class="gd-cta-title">User Guide</span>
<span class="gd-cta-desc">Installation, quick start, extensions, output formats, options, and recipes.</span>
<span class="gd-cta-arrow">→</span>
</a>
<a href="reference/index.html" class="gd-cta-card">
<span class="gd-cta-icon">⚙️</span>
<span class="gd-cta-title">API Reference</span>
<span class="gd-cta-desc">Full documentation for every renderer, option flag, and utility function.</span>
<span class="gd-cta-arrow">→</span>
</a>
</div>
```