mddoco 2.1.0__tar.gz → 2.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {mddoco-2.1.0/src/mddoco.egg-info → mddoco-2.2.0}/PKG-INFO +33 -4
- {mddoco-2.1.0 → mddoco-2.2.0}/README.md +287 -258
- {mddoco-2.1.0 → mddoco-2.2.0}/pyproject.toml +1 -1
- mddoco-2.2.0/src/mddoco/__init__.py +1 -0
- {mddoco-2.1.0 → mddoco-2.2.0}/src/mddoco/cli.py +6 -1
- {mddoco-2.1.0 → mddoco-2.2.0}/src/mddoco/pdf.py +20 -1
- mddoco-2.2.0/src/mddoco/renderer.py +57 -0
- mddoco-2.2.0/src/mddoco/themes/_site_base.html +382 -0
- mddoco-2.2.0/src/mddoco/themes/academic-wide.html +7 -0
- {mddoco-2.1.0 → mddoco-2.2.0}/src/mddoco/themes/academic.html +3 -1
- mddoco-2.2.0/src/mddoco/themes/dark-wide.html +7 -0
- {mddoco-2.1.0 → mddoco-2.2.0}/src/mddoco/themes/dark.html +8 -1
- mddoco-2.2.0/src/mddoco/themes/default-wide.html +7 -0
- {mddoco-2.1.0 → mddoco-2.2.0}/src/mddoco/themes/default.html +8 -1
- {mddoco-2.1.0 → mddoco-2.2.0}/src/mddoco/themes/paged-professional.html +30 -13
- mddoco-2.2.0/src/mddoco/themes/professional-wide.html +14 -0
- {mddoco-2.1.0 → mddoco-2.2.0}/src/mddoco/themes/professional.html +9 -1
- mddoco-2.2.0/src/mddoco/themes/site-dark.html +37 -0
- mddoco-2.2.0/src/mddoco/themes/site-professional.html +67 -0
- mddoco-2.2.0/src/mddoco/themes/site-terminal.html +65 -0
- mddoco-2.2.0/src/mddoco/themes/site.html +8 -0
- {mddoco-2.1.0 → mddoco-2.2.0}/src/mddoco/themes/vanilla.html +2 -1
- {mddoco-2.1.0 → mddoco-2.2.0/src/mddoco.egg-info}/PKG-INFO +33 -4
- {mddoco-2.1.0 → mddoco-2.2.0}/src/mddoco.egg-info/SOURCES.txt +7 -1
- {mddoco-2.1.0 → mddoco-2.2.0}/tests/test_preprocessor.py +1 -1
- mddoco-2.2.0/tests/test_themes.py +63 -0
- mddoco-2.1.0/src/mddoco/__init__.py +0 -1
- mddoco-2.1.0/src/mddoco/renderer.py +0 -35
- mddoco-2.1.0/src/mddoco/themes/academic-wide.html +0 -191
- mddoco-2.1.0/src/mddoco/themes/dark-wide.html +0 -183
- mddoco-2.1.0/src/mddoco/themes/default-wide.html +0 -164
- mddoco-2.1.0/src/mddoco/themes/professional-wide.html +0 -228
- {mddoco-2.1.0 → mddoco-2.2.0}/LICENSE +0 -0
- {mddoco-2.1.0 → mddoco-2.2.0}/setup.cfg +0 -0
- {mddoco-2.1.0 → mddoco-2.2.0}/src/mddoco/converter.py +0 -0
- {mddoco-2.1.0 → mddoco-2.2.0}/src/mddoco/graph.py +0 -0
- {mddoco-2.1.0 → mddoco-2.2.0}/src/mddoco/mermaid.py +0 -0
- {mddoco-2.1.0 → mddoco-2.2.0}/src/mddoco/preprocessor.py +0 -0
- {mddoco-2.1.0 → mddoco-2.2.0}/src/mddoco/scanner.py +0 -0
- {mddoco-2.1.0 → mddoco-2.2.0}/src/mddoco/toc.py +0 -0
- {mddoco-2.1.0 → mddoco-2.2.0}/src/mddoco/writer.py +0 -0
- {mddoco-2.1.0 → mddoco-2.2.0}/src/mddoco.egg-info/dependency_links.txt +0 -0
- {mddoco-2.1.0 → mddoco-2.2.0}/src/mddoco.egg-info/entry_points.txt +0 -0
- {mddoco-2.1.0 → mddoco-2.2.0}/src/mddoco.egg-info/requires.txt +0 -0
- {mddoco-2.1.0 → mddoco-2.2.0}/src/mddoco.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: mddoco
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.2.0
|
|
4
4
|
Summary: Markdown to HTML/PDF document converter
|
|
5
5
|
Author-email: Phil Massyn <phil.massyn@icloud.com>
|
|
6
6
|
Project-URL: Homepage, https://github.com/massyn/mddoco
|
|
@@ -93,7 +93,7 @@ All matched markdown files are combined into a single HTML document in the outpu
|
|
|
93
93
|
|
|
94
94
|
## Examples
|
|
95
95
|
|
|
96
|
-
The [`examples/`](examples/) directory contains
|
|
96
|
+
The [`examples/`](examples/) directory contains five runnable input folders, each
|
|
97
97
|
covering a different feature:
|
|
98
98
|
|
|
99
99
|
| Folder | Demonstrates |
|
|
@@ -102,6 +102,7 @@ covering a different feature:
|
|
|
102
102
|
| [`examples/02_rich_content`](examples/02_rich_content) | Mermaid diagrams, syntax highlighting, `graph` charts |
|
|
103
103
|
| [`examples/03_themed_report`](examples/03_themed_report) | Themes and a table of contents |
|
|
104
104
|
| [`examples/04_jinja_data`](examples/04_jinja_data) | Jinja2 templates with JSON and CSV data files |
|
|
105
|
+
| [`examples/05_security_findings`](examples/05_security_findings) | CSV data grouped in a Jinja2 template and fed into a `graph` chart |
|
|
105
106
|
|
|
106
107
|
```bash
|
|
107
108
|
mddoco examples/03_themed_report --theme professional --title "Q3 Platform Review" --toc --output ./out
|
|
@@ -181,7 +182,7 @@ Use `{% import %}` or `{% from ... import %}` to make macros from another file c
|
|
|
181
182
|
|
|
182
183
|
## Themes
|
|
183
184
|
|
|
184
|
-
Themes are
|
|
185
|
+
Themes are Jinja2 HTML files with embedded CSS. Pass a theme name with `--theme NAME`. The `-wide` and `site-*` themes extend another theme (`default.html`, `_site_base.html` and so on), so to customise one of those, copy the theme it extends as well.
|
|
185
186
|
|
|
186
187
|
| Theme | Description |
|
|
187
188
|
|---|---|
|
|
@@ -195,14 +196,42 @@ Themes are self-contained Jinja2 HTML files with embedded CSS. Pass a theme name
|
|
|
195
196
|
| `academic-wide` | Same as `academic` but full viewport width |
|
|
196
197
|
| `vanilla` | Minimal HTML with no styling — useful for testing or custom CSS |
|
|
197
198
|
| `paged-professional` | Corporate style with Paged.js pagination for print-ready PDFs |
|
|
199
|
+
| `site` | Website layout: side nav with one page per H1, minimalist styling (HTML only) |
|
|
200
|
+
| `site-professional` | Same as `site` with a navy sidebar and card layout (HTML only) |
|
|
201
|
+
| `site-dark` | Same as `site` on a dark background (HTML only) |
|
|
202
|
+
| `site-terminal` | Same as `site` as a green-phosphor terminal, just for fun (HTML only) |
|
|
198
203
|
|
|
199
204
|
All themes support:
|
|
200
205
|
|
|
201
206
|
- Optional document title
|
|
202
|
-
- Optional table of contents
|
|
207
|
+
- Optional table of contents (the `site-*` themes use their side nav instead)
|
|
203
208
|
- [Mermaid.js](https://mermaid.js.org) diagram support (loaded only when diagrams are present)
|
|
204
209
|
- Graph diagram blocks
|
|
205
210
|
|
|
211
|
+
### Site themes
|
|
212
|
+
|
|
213
|
+
The `site-*` themes turn the output into a small website while keeping it a single HTML file: no web server needed, and it still works offline or as an email attachment.
|
|
214
|
+
|
|
215
|
+
```bash
|
|
216
|
+
mddoco ./docs --theme site --title "Team Handbook" --output ./out
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
- Every H1 starts a new page, and each page is listed in the side nav. Anything before the first H1 becomes an introduction page.
|
|
220
|
+
- The current page's H2 headings are listed under it in the nav.
|
|
221
|
+
- Only one page shows at a time, with previous/next links at the bottom. Each page has its own address (`handbook.html#/onboarding`, or `#/onboarding/first-week` for a heading), so the back button, bookmarks and shared links work.
|
|
222
|
+
- On narrow screens the nav moves behind a menu button.
|
|
223
|
+
- They are screen-only: `--format pdf` is refused. Printing from the browser still prints every page in sequence.
|
|
224
|
+
|
|
225
|
+
### Screen-only custom themes
|
|
226
|
+
|
|
227
|
+
A custom theme can refuse PDF output by declaring this at the top level of its template:
|
|
228
|
+
|
|
229
|
+
```jinja
|
|
230
|
+
{% set pdf_supported = false %}
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
`--format pdf` with that theme then exits with an error instead of producing a PDF.
|
|
234
|
+
|
|
206
235
|
### Graph diagrams
|
|
207
236
|
|
|
208
237
|
Use ` ```graph ` fenced blocks with a JSON payload. The only required field is `data`.
|
|
@@ -1,258 +1,287 @@
|
|
|
1
|
-
# mddoco
|
|
2
|
-
|
|
3
|
-
A CLI tool that converts markdown files to a single HTML (or future PDF) document.
|
|
4
|
-
|
|
5
|
-
[](https://github.com/massyn/mddoco/actions/workflows/ci.yml)
|
|
6
|
-
 
|
|
7
|
-
## Installation
|
|
8
|
-
|
|
9
|
-
```bash
|
|
10
|
-
pip install mddoco
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
Or for development:
|
|
14
|
-
|
|
15
|
-
```bash
|
|
16
|
-
pip install -e .
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
> **Playwright (Chromium) is required for PDF output only.** HTML output works without it.
|
|
20
|
-
> The `playwright` Python package is installed automatically, but the Chromium
|
|
21
|
-
> browser it drives is not. The first time you render a PDF, mddoco downloads
|
|
22
|
-
> Chromium for you (~150 MB, one time). To do it ahead of time, or if the
|
|
23
|
-
> automatic download fails, run it yourself:
|
|
24
|
-
>
|
|
25
|
-
> ```bash
|
|
26
|
-
> playwright install chromium
|
|
27
|
-
> ```
|
|
28
|
-
|
|
29
|
-
## Usage
|
|
30
|
-
|
|
31
|
-
```
|
|
32
|
-
mddoco [OPTIONS] INPUT_PATH
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
`INPUT_PATH` can be a **directory** (all `*.md` and `*.md.j2` files are found recursively and sorted together) or a **single `.md` or `.md.j2` file**.
|
|
36
|
-
|
|
37
|
-
### Options
|
|
38
|
-
|
|
39
|
-
| Option | Short | Default | Description |
|
|
40
|
-
|---|---|---|---|
|
|
41
|
-
| `--output PATH` | `-o` | `.` | Directory to write the output file |
|
|
42
|
-
| `--format [html\|pdf]` | `-f` | `html` | Output format |
|
|
43
|
-
| `--title TEXT` | `-t` | _(none)_ | Document title shown at the top of the page |
|
|
44
|
-
| `--theme NAME` | | `default` | Theme to use for rendering |
|
|
45
|
-
| `--toc / --no-toc` | | off | Generate a table of contents |
|
|
46
|
-
| `--toc-depth N` | | `3` | Maximum heading depth included in the TOC (1–6) |
|
|
47
|
-
|
|
48
|
-
### Examples
|
|
49
|
-
|
|
50
|
-
Convert all markdown files in a directory:
|
|
51
|
-
|
|
52
|
-
```bash
|
|
53
|
-
mddoco ./docs
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
Convert a single file:
|
|
57
|
-
|
|
58
|
-
```bash
|
|
59
|
-
mddoco README.md
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
With a title, TOC, and custom output directory:
|
|
63
|
-
|
|
64
|
-
```bash
|
|
65
|
-
mddoco ./docs --title "My Project" --toc --output ./out
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
## Output
|
|
69
|
-
|
|
70
|
-
All matched markdown files are combined into a single HTML document in the output directory. The filename is derived from the input folder or file name.
|
|
71
|
-
|
|
72
|
-
## Examples
|
|
73
|
-
|
|
74
|
-
The [`examples/`](examples/) directory contains
|
|
75
|
-
covering a different feature:
|
|
76
|
-
|
|
77
|
-
| Folder | Demonstrates |
|
|
78
|
-
|--------|--------------|
|
|
79
|
-
| [`examples/01_basic`](examples/01_basic) | Plain Markdown, file ordering, underscore-excluded files |
|
|
80
|
-
| [`examples/02_rich_content`](examples/02_rich_content) | Mermaid diagrams, syntax highlighting, `graph` charts |
|
|
81
|
-
| [`examples/03_themed_report`](examples/03_themed_report) | Themes and a table of contents |
|
|
82
|
-
| [`examples/04_jinja_data`](examples/04_jinja_data) | Jinja2 templates with JSON and CSV data files |
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
{
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
{{ people[
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
{
|
|
149
|
-
{
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
{
|
|
153
|
-
{
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
{
|
|
157
|
-
{
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
| `default
|
|
168
|
-
| `
|
|
169
|
-
| `professional
|
|
170
|
-
| `
|
|
171
|
-
| `dark
|
|
172
|
-
| `
|
|
173
|
-
| `academic
|
|
174
|
-
| `
|
|
175
|
-
| `
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
-
|
|
180
|
-
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
**
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
````
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
1
|
+
# mddoco
|
|
2
|
+
|
|
3
|
+
A CLI tool that converts markdown files to a single HTML (or future PDF) document.
|
|
4
|
+
|
|
5
|
+
[](https://github.com/massyn/mddoco/actions/workflows/ci.yml)
|
|
6
|
+
 
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
pip install mddoco
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Or for development:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
pip install -e .
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
> **Playwright (Chromium) is required for PDF output only.** HTML output works without it.
|
|
20
|
+
> The `playwright` Python package is installed automatically, but the Chromium
|
|
21
|
+
> browser it drives is not. The first time you render a PDF, mddoco downloads
|
|
22
|
+
> Chromium for you (~150 MB, one time). To do it ahead of time, or if the
|
|
23
|
+
> automatic download fails, run it yourself:
|
|
24
|
+
>
|
|
25
|
+
> ```bash
|
|
26
|
+
> playwright install chromium
|
|
27
|
+
> ```
|
|
28
|
+
|
|
29
|
+
## Usage
|
|
30
|
+
|
|
31
|
+
```
|
|
32
|
+
mddoco [OPTIONS] INPUT_PATH
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
`INPUT_PATH` can be a **directory** (all `*.md` and `*.md.j2` files are found recursively and sorted together) or a **single `.md` or `.md.j2` file**.
|
|
36
|
+
|
|
37
|
+
### Options
|
|
38
|
+
|
|
39
|
+
| Option | Short | Default | Description |
|
|
40
|
+
|---|---|---|---|
|
|
41
|
+
| `--output PATH` | `-o` | `.` | Directory to write the output file |
|
|
42
|
+
| `--format [html\|pdf]` | `-f` | `html` | Output format |
|
|
43
|
+
| `--title TEXT` | `-t` | _(none)_ | Document title shown at the top of the page |
|
|
44
|
+
| `--theme NAME` | | `default` | Theme to use for rendering |
|
|
45
|
+
| `--toc / --no-toc` | | off | Generate a table of contents |
|
|
46
|
+
| `--toc-depth N` | | `3` | Maximum heading depth included in the TOC (1–6) |
|
|
47
|
+
|
|
48
|
+
### Examples
|
|
49
|
+
|
|
50
|
+
Convert all markdown files in a directory:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
mddoco ./docs
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Convert a single file:
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
mddoco README.md
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
With a title, TOC, and custom output directory:
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
mddoco ./docs --title "My Project" --toc --output ./out
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Output
|
|
69
|
+
|
|
70
|
+
All matched markdown files are combined into a single HTML document in the output directory. The filename is derived from the input folder or file name.
|
|
71
|
+
|
|
72
|
+
## Examples
|
|
73
|
+
|
|
74
|
+
The [`examples/`](examples/) directory contains five runnable input folders, each
|
|
75
|
+
covering a different feature:
|
|
76
|
+
|
|
77
|
+
| Folder | Demonstrates |
|
|
78
|
+
|--------|--------------|
|
|
79
|
+
| [`examples/01_basic`](examples/01_basic) | Plain Markdown, file ordering, underscore-excluded files |
|
|
80
|
+
| [`examples/02_rich_content`](examples/02_rich_content) | Mermaid diagrams, syntax highlighting, `graph` charts |
|
|
81
|
+
| [`examples/03_themed_report`](examples/03_themed_report) | Themes and a table of contents |
|
|
82
|
+
| [`examples/04_jinja_data`](examples/04_jinja_data) | Jinja2 templates with JSON and CSV data files |
|
|
83
|
+
| [`examples/05_security_findings`](examples/05_security_findings) | CSV data grouped in a Jinja2 template and fed into a `graph` chart |
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
mddoco examples/03_themed_report --theme professional --title "Q3 Platform Review" --toc --output ./out
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
See [`examples/README.md`](examples/README.md) for the full list of commands.
|
|
90
|
+
|
|
91
|
+
## Jinja2 templates
|
|
92
|
+
|
|
93
|
+
Files ending in `.md.j2` are Jinja2 templates that produce Markdown. They are sorted alongside regular `.md` files (numeric prefixes such as `01_`, `02_` determine order) and converted through the same pipeline.
|
|
94
|
+
|
|
95
|
+
### Context variables (JSON and CSV)
|
|
96
|
+
|
|
97
|
+
Place `*.json` or `*.csv` files in the same input directory. Each file's stem becomes a top-level variable in the Jinja2 context — `report.json` is available as `report`, `people.csv` as `people`, and so on. If both `data.json` and `data.csv` exist, the tool will exit with an error.
|
|
98
|
+
|
|
99
|
+
```
|
|
100
|
+
docs/
|
|
101
|
+
01_intro.md
|
|
102
|
+
02_summary.md.j2 ← Jinja2 template
|
|
103
|
+
report.json ← available as {{ report }}
|
|
104
|
+
people.csv ← available as {{ people }}
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
**JSON** files are loaded as-is; the variable holds whatever structure the JSON contains.
|
|
108
|
+
|
|
109
|
+
**CSV** files are loaded as a list of row dicts, one dict per row:
|
|
110
|
+
|
|
111
|
+
```markdown
|
|
112
|
+
{% for person in people %}
|
|
113
|
+
- {{ person.name }} ({{ person.role }})
|
|
114
|
+
{% endfor %}
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
Cell values containing `;` are automatically split into a list:
|
|
118
|
+
|
|
119
|
+
```csv
|
|
120
|
+
name,skills
|
|
121
|
+
Alice,python;flask;sql
|
|
122
|
+
Bob,java
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
```markdown
|
|
126
|
+
{{ people[0].skills }} {# → ["python", "flask", "sql"] #}
|
|
127
|
+
{{ people[1].skills }} {# → "java" (plain string — no ;) #}
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
Quoting a field in the CSV prevents `;` splitting — `"python;flask"` remains a single string.
|
|
131
|
+
|
|
132
|
+
### Excluding files
|
|
133
|
+
|
|
134
|
+
Files whose name starts with `_` are excluded from scanning. Use this for Jinja2 macro files that should be imported but not rendered as documents:
|
|
135
|
+
|
|
136
|
+
```
|
|
137
|
+
docs/
|
|
138
|
+
_macros.j2 ← excluded; safe to use with {% import %}
|
|
139
|
+
01_intro.md
|
|
140
|
+
02_report.md.j2
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
### Using macros
|
|
144
|
+
|
|
145
|
+
Use `{% import %}` or `{% from ... import %}` to make macros from another file callable — **not** `{% include %}`. `{% include %}` injects rendered output only; macros defined in an included file are not visible to the calling template and will raise an `undefined` error.
|
|
146
|
+
|
|
147
|
+
```jinja
|
|
148
|
+
{# correct — macro is callable after this #}
|
|
149
|
+
{% import "_macros.j2" as macros %}
|
|
150
|
+
{{ macros.val(item) }}
|
|
151
|
+
|
|
152
|
+
{# also correct #}
|
|
153
|
+
{% from "_macros.j2" import val %}
|
|
154
|
+
{{ val(item) }}
|
|
155
|
+
|
|
156
|
+
{# wrong — val will be undefined #}
|
|
157
|
+
{% include "_macros.j2" %}
|
|
158
|
+
{{ val(item) }}
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
## Themes
|
|
162
|
+
|
|
163
|
+
Themes are Jinja2 HTML files with embedded CSS. Pass a theme name with `--theme NAME`. The `-wide` and `site-*` themes extend another theme (`default.html`, `_site_base.html` and so on), so to customise one of those, copy the theme it extends as well.
|
|
164
|
+
|
|
165
|
+
| Theme | Description |
|
|
166
|
+
|---|---|
|
|
167
|
+
| `default` | Clean GitHub-style layout, 860 px centred column |
|
|
168
|
+
| `default-wide` | Same as `default` but full viewport width |
|
|
169
|
+
| `professional` | Corporate blue palette, dark title banner, card layout, 900 px centred |
|
|
170
|
+
| `professional-wide` | Same as `professional` but full viewport width |
|
|
171
|
+
| `dark` | Dark background, blue accent, light text — good for technical docs, 860 px centred |
|
|
172
|
+
| `dark-wide` | Same as `dark` but full viewport width |
|
|
173
|
+
| `academic` | Serif (Georgia) typography, justified text, print-optimised, 720 px centred |
|
|
174
|
+
| `academic-wide` | Same as `academic` but full viewport width |
|
|
175
|
+
| `vanilla` | Minimal HTML with no styling — useful for testing or custom CSS |
|
|
176
|
+
| `paged-professional` | Corporate style with Paged.js pagination for print-ready PDFs |
|
|
177
|
+
| `site` | Website layout: side nav with one page per H1, minimalist styling (HTML only) |
|
|
178
|
+
| `site-professional` | Same as `site` with a navy sidebar and card layout (HTML only) |
|
|
179
|
+
| `site-dark` | Same as `site` on a dark background (HTML only) |
|
|
180
|
+
| `site-terminal` | Same as `site` as a green-phosphor terminal, just for fun (HTML only) |
|
|
181
|
+
|
|
182
|
+
All themes support:
|
|
183
|
+
|
|
184
|
+
- Optional document title
|
|
185
|
+
- Optional table of contents (the `site-*` themes use their side nav instead)
|
|
186
|
+
- [Mermaid.js](https://mermaid.js.org) diagram support (loaded only when diagrams are present)
|
|
187
|
+
- Graph diagram blocks
|
|
188
|
+
|
|
189
|
+
### Site themes
|
|
190
|
+
|
|
191
|
+
The `site-*` themes turn the output into a small website while keeping it a single HTML file: no web server needed, and it still works offline or as an email attachment.
|
|
192
|
+
|
|
193
|
+
```bash
|
|
194
|
+
mddoco ./docs --theme site --title "Team Handbook" --output ./out
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
- Every H1 starts a new page, and each page is listed in the side nav. Anything before the first H1 becomes an introduction page.
|
|
198
|
+
- The current page's H2 headings are listed under it in the nav.
|
|
199
|
+
- Only one page shows at a time, with previous/next links at the bottom. Each page has its own address (`handbook.html#/onboarding`, or `#/onboarding/first-week` for a heading), so the back button, bookmarks and shared links work.
|
|
200
|
+
- On narrow screens the nav moves behind a menu button.
|
|
201
|
+
- They are screen-only: `--format pdf` is refused. Printing from the browser still prints every page in sequence.
|
|
202
|
+
|
|
203
|
+
### Screen-only custom themes
|
|
204
|
+
|
|
205
|
+
A custom theme can refuse PDF output by declaring this at the top level of its template:
|
|
206
|
+
|
|
207
|
+
```jinja
|
|
208
|
+
{% set pdf_supported = false %}
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
`--format pdf` with that theme then exits with an error instead of producing a PDF.
|
|
212
|
+
|
|
213
|
+
### Graph diagrams
|
|
214
|
+
|
|
215
|
+
Use ` ```graph ` fenced blocks with a JSON payload. The only required field is `data`.
|
|
216
|
+
|
|
217
|
+
**Minimal example** — all defaults applied:
|
|
218
|
+
|
|
219
|
+
````markdown
|
|
220
|
+
```graph
|
|
221
|
+
{
|
|
222
|
+
"data": {
|
|
223
|
+
"x": ["Jan", "Feb", "Mar"],
|
|
224
|
+
"Sales": [100, 150, 120]
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
```
|
|
228
|
+
````
|
|
229
|
+
|
|
230
|
+
Series are inferred from the data keys (everything except `x`). Each series defaults to a line chart in blue.
|
|
231
|
+
|
|
232
|
+
**Full schema:**
|
|
233
|
+
|
|
234
|
+
| Field | Required | Default | Description |
|
|
235
|
+
|---|---|---|---|
|
|
236
|
+
| `data.x` | yes | — | Category labels |
|
|
237
|
+
| `data.<name>` | yes | — | Values for each series (one key per series) |
|
|
238
|
+
| `title` | no | _(none)_ | Chart title |
|
|
239
|
+
| `orientation` | no | `vertical` | `vertical` or `horizontal` |
|
|
240
|
+
| `show_legend` | no | `true` | Show the legend |
|
|
241
|
+
| `width_px` | no | `640` | Width in pixels |
|
|
242
|
+
| `height_px` | no | `480` | Height in pixels |
|
|
243
|
+
| `min` / `max` | no | — | Axis bounds |
|
|
244
|
+
| `series` | no | _(auto)_ | Override series definitions (see below) |
|
|
245
|
+
|
|
246
|
+
**Series fields** (all optional when auto-generated):
|
|
247
|
+
|
|
248
|
+
| Field | Default | Description |
|
|
249
|
+
|---|---|---|
|
|
250
|
+
| `label` | _(data key)_ | Must match a key in `data` |
|
|
251
|
+
| `type` | `line` | `bar`, `line` (solid), or `line2` (dotted) |
|
|
252
|
+
| `colour` | _(palette)_ | Colour string, or list of colours per bar |
|
|
253
|
+
| `marker` | `false` | Show point markers (line types only) |
|
|
254
|
+
|
|
255
|
+
**Full example:**
|
|
256
|
+
|
|
257
|
+
````markdown
|
|
258
|
+
```graph
|
|
259
|
+
{
|
|
260
|
+
"title": "Sales vs Target",
|
|
261
|
+
"orientation": "vertical",
|
|
262
|
+
"show_legend": true,
|
|
263
|
+
"data": {
|
|
264
|
+
"x": ["Jan", "Feb", "Mar", "Apr", "May"],
|
|
265
|
+
"Sales": [85, 92, 78, 96, 110],
|
|
266
|
+
"Target": [90, 90, 90, 90, 90]
|
|
267
|
+
},
|
|
268
|
+
"series": [
|
|
269
|
+
{ "label": "Sales", "type": "bar", "colour": "#3498db" },
|
|
270
|
+
{ "label": "Target", "type": "line", "colour": "#e74c3c", "marker": false }
|
|
271
|
+
]
|
|
272
|
+
}
|
|
273
|
+
```
|
|
274
|
+
````
|
|
275
|
+
|
|
276
|
+
### Mermaid diagrams
|
|
277
|
+
|
|
278
|
+
Use standard fenced code blocks in your markdown:
|
|
279
|
+
|
|
280
|
+
````markdown
|
|
281
|
+
```mermaid
|
|
282
|
+
graph TD
|
|
283
|
+
A[Start] --> B[End]
|
|
284
|
+
```
|
|
285
|
+
````
|
|
286
|
+
|
|
287
|
+
mddoco detects mermaid blocks automatically and loads the Mermaid.js CDN only when needed.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "2.2.0"
|