Commit fd06857
authored
Add --standardize and --no-execute CLI flags (#44)
* Strip markdown-code-runner modifier from code fences in docs
The docs site renderer (Zensical/pymdownx) doesn't understand the
"python markdown-code-runner" syntax for code fence language identifiers.
This causes the fenced code blocks to be parsed as inline code instead
of proper code blocks, breaking the rendering.
Add a regex transformation in _transform_readme_links() to strip the
"markdown-code-runner" modifier when pulling content from README into
the docs templates.
* Add --standardize and --no-execute CLI flags
This adds two new CLI flags to support standardizing code fences for
compatibility with markdown processors like mkdocs and pandoc:
- `--standardize` / `-s`: Post-process to standardize ALL code fences,
removing 'markdown-code-runner' modifiers from language identifiers
- `--no-execute` / `-n`: Skip code execution entirely
These flags can be combined for different use cases:
- `--standardize`: Execute code AND standardize output
- `--no-execute --standardize`: Only standardize, no execution
- Default: Execute code with inline standardization of executed blocks
The docs_gen.py script now uses `--standardize` instead of the regex
workaround, making the solution available as a CLI option for all users.
Closes #26
* Update README.md
* Add documentation for --standardize and --no-execute flags
Document the new CLI flags and Python API parameters:
- CLI: --standardize/-s and --no-execute/-n options
- Python API: execute and standardize parameters for update_markdown_file
- Python API: standardize_code_fences utility function
- Added usage examples for all new functionality
* Add test for verbose output with standardize flag1 parent dff4f8d commit fd06857
File tree
7 files changed
+422
-7
lines changed- docs
- usage
- tests
7 files changed
+422
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
358 | 358 | | |
359 | 359 | | |
360 | 360 | | |
361 | | - | |
| 361 | + | |
362 | 362 | | |
363 | 363 | | |
364 | 364 | | |
| |||
375 | 375 | | |
376 | 376 | | |
377 | 377 | | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
378 | 382 | | |
379 | 383 | | |
380 | 384 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| |||
133 | 133 | | |
134 | 134 | | |
135 | 135 | | |
136 | | - | |
| 136 | + | |
137 | 137 | | |
138 | 138 | | |
139 | 139 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
64 | 102 | | |
65 | 103 | | |
66 | 104 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
| 29 | + | |
28 | 30 | | |
29 | 31 | | |
30 | 32 | | |
| |||
37 | 39 | | |
38 | 40 | | |
39 | 41 | | |
40 | | - | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
41 | 50 | | |
42 | 51 | | |
43 | 52 | | |
| |||
51 | 60 | | |
52 | 61 | | |
53 | 62 | | |
| 63 | + | |
54 | 64 | | |
55 | 65 | | |
56 | 66 | | |
| |||
61 | 71 | | |
62 | 72 | | |
63 | 73 | | |
64 | | - | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
65 | 78 | | |
66 | 79 | | |
67 | 80 | | |
| |||
70 | 83 | | |
71 | 84 | | |
72 | 85 | | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
73 | 109 | | |
74 | 110 | | |
75 | 111 | | |
| |||
117 | 153 | | |
118 | 154 | | |
119 | 155 | | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
161 | 161 | | |
162 | 162 | | |
163 | 163 | | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 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 | + | |
164 | 200 | | |
165 | 201 | | |
166 | 202 | | |
| |||
310 | 346 | | |
311 | 347 | | |
312 | 348 | | |
| 349 | + | |
313 | 350 | | |
314 | 351 | | |
315 | 352 | | |
| |||
321 | 358 | | |
322 | 359 | | |
323 | 360 | | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
324 | 364 | | |
325 | 365 | | |
326 | 366 | | |
| |||
329 | 369 | | |
330 | 370 | | |
331 | 371 | | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
332 | 375 | | |
333 | 376 | | |
334 | 377 | | |
| |||
339 | 382 | | |
340 | 383 | | |
341 | 384 | | |
342 | | - | |
| 385 | + | |
343 | 386 | | |
344 | 387 | | |
345 | 388 | | |
346 | 389 | | |
347 | 390 | | |
| 391 | + | |
| 392 | + | |
348 | 393 | | |
349 | 394 | | |
350 | 395 | | |
| |||
357 | 402 | | |
358 | 403 | | |
359 | 404 | | |
360 | | - | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
361 | 413 | | |
362 | 414 | | |
363 | 415 | | |
| |||
370 | 422 | | |
371 | 423 | | |
372 | 424 | | |
| 425 | + | |
373 | 426 | | |
374 | 427 | | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
375 | 435 | | |
376 | 436 | | |
377 | 437 | | |
| |||
418 | 478 | | |
419 | 479 | | |
420 | 480 | | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
421 | 495 | | |
422 | 496 | | |
423 | 497 | | |
| |||
434 | 508 | | |
435 | 509 | | |
436 | 510 | | |
| 511 | + | |
| 512 | + | |
437 | 513 | | |
438 | 514 | | |
439 | 515 | | |
| |||
0 commit comments