Skip to content

Commit 2eb683c

Browse files
committed
Update README
1 parent 2102417 commit 2eb683c

File tree

2 files changed

+43
-17
lines changed

2 files changed

+43
-17
lines changed

.cspell.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"brotlicffi",
1111
"certifi",
1212
"cffi",
13+
"codehilite",
1314
"colorama",
1415
"cssselect",
1516
"dateutil",
@@ -27,6 +28,7 @@
2728
"mmdc",
2829
"newbranch",
2930
"pathspec",
31+
"pelicanconf",
3032
"platformdirs",
3133
"pycache",
3234
"pycparser",

README.md

Lines changed: 41 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,8 @@
33
[Mermaid][mermaid] extension for [Python-Markdown][python-markdown] using [Mermaid-CLI][mermaid-cli].
44

55
This extension converts Mermaid diagram code blocks into Base64 encoded [data: URI][data-uri].
6-
This enables PDF generation with tools like [MkDocs to PDF][mkdocs-to-pdf]/[WeasyPrint][wasyprint] without requiring JavaScript, even during web browsing.
7-
8-
[mermaid]: https://mermaid.js.org/
9-
[python-markdown]: https://python-markdown.github.io/
10-
[mermaid-cli]: https://github.com/mermaid-js/mermaid-cli
11-
[data-uri]: https://developer.mozilla.org/en-US/docs/Web/URI/Reference/Schemes/data
12-
[mkdocs-to-pdf]: https://mkdocs-to-pdf.readthedocs.io/
13-
[wasyprint]: https://weasyprint.org/
6+
This enables PDF generation with tools like [MkDocs to PDF][mkdocs-to-pdf]/[WeasyPrint][wasyprint]
7+
without requiring client-side JavaScript.
148

159
## Install
1610

@@ -22,6 +16,8 @@ pip install markdown-mermaid-cli
2216

2317
### Mermaid CLI
2418

19+
> Chrome or Chromium is required to run Mermaid-CLI.
20+
2521
```sh
2622
npm install @mermaid-js/mermaid-cli
2723
```
@@ -34,6 +30,33 @@ npm install --global @mermaid-js/mermaid-cli
3430

3531
## Usage
3632

33+
````mermaid formant=[svg|png] {img tag attribute}="value" {mermaid cli option}="value"
34+
````
35+
36+
### [MkDocs][mkdocs] Integration
37+
38+
```yaml
39+
# mkdocs.yml
40+
markdown_extensions:
41+
- markdown_mermaid_cli
42+
```
43+
44+
### [Pelican][pelican] Integration
45+
46+
```py
47+
# pelicanconf.py
48+
MARKDOWN = {
49+
'extension_configs': {
50+
'markdown.extensions.codehilite': {'css_class': 'highlight'},
51+
'markdown.extensions.extra': {},
52+
'markdown_mermaid_cli': {}, # Add this
53+
},
54+
'output_format': 'html5',
55+
}
56+
```
57+
58+
### Python code
59+
3760
````python
3861
import markdown
3962
from markdown_mermaid_cli import MermaidExtension
@@ -63,15 +86,7 @@ Gg6IDc1MHB4OyBiYWNrZ3JvdW5kLWNvbG9yOiB3aGl0ZTsiIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3L
6386
IHgxPSIyNzYiLz48L3N2Zz4=" ></p>
6487
```
6588

66-
## MkDocs Integration
67-
68-
```yaml
69-
# mkdocs.yml
70-
markdown_extensions:
71-
- markdown_mermaid_cli
72-
```
73-
74-
## Diagram
89+
## Process flow
7590

7691
```mermaid
7792
sequenceDiagram
@@ -89,3 +104,12 @@ sequenceDiagram
89104
extension-->>markdown: Markdown + data URI image
90105
markdown-->>application: HTML + data URI image
91106
```
107+
108+
[mermaid]: https://mermaid.js.org/
109+
[python-markdown]: https://python-markdown.github.io/
110+
[mermaid-cli]: https://github.com/mermaid-js/mermaid-cli
111+
[data-uri]: https://developer.mozilla.org/en-US/docs/Web/URI/Reference/Schemes/data
112+
[mkdocs-to-pdf]: https://mkdocs-to-pdf.readthedocs.io/
113+
[wasyprint]: https://weasyprint.org/
114+
[mkdocs]: https://www.mkdocs.org/
115+
[pelican]: https://getpelican.com/

0 commit comments

Comments
 (0)