markdown-exec 1.12.0__tar.gz → 1.12.1__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.
- {markdown_exec-1.12.0 → markdown_exec-1.12.1}/CHANGELOG.md +8 -0
- markdown_exec-1.12.1/PKG-INFO +214 -0
- markdown_exec-1.12.1/README.md +178 -0
- {markdown_exec-1.12.0 → markdown_exec-1.12.1}/pyproject.toml +1 -1
- {markdown_exec-1.12.0 → markdown_exec-1.12.1}/src/markdown_exec/_internal/rendering.py +5 -0
- markdown_exec-1.12.0/PKG-INFO +0 -156
- markdown_exec-1.12.0/README.md +0 -120
- {markdown_exec-1.12.0 → markdown_exec-1.12.1}/CODE_OF_CONDUCT.md +0 -0
- {markdown_exec-1.12.0 → markdown_exec-1.12.1}/CONTRIBUTING.md +0 -0
- {markdown_exec-1.12.0 → markdown_exec-1.12.1}/LICENSE +0 -0
- {markdown_exec-1.12.0 → markdown_exec-1.12.1}/config/coverage.ini +0 -0
- {markdown_exec-1.12.0 → markdown_exec-1.12.1}/config/git-changelog.toml +0 -0
- {markdown_exec-1.12.0 → markdown_exec-1.12.1}/config/mypy.ini +0 -0
- {markdown_exec-1.12.0 → markdown_exec-1.12.1}/config/pytest.ini +0 -0
- {markdown_exec-1.12.0 → markdown_exec-1.12.1}/config/ruff.toml +0 -0
- {markdown_exec-1.12.0 → markdown_exec-1.12.1}/config/vscode/launch.json +0 -0
- {markdown_exec-1.12.0 → markdown_exec-1.12.1}/config/vscode/settings.json +0 -0
- {markdown_exec-1.12.0 → markdown_exec-1.12.1}/config/vscode/tasks.json +0 -0
- {markdown_exec-1.12.0 → markdown_exec-1.12.1}/docs/.overrides/main.html +0 -0
- {markdown_exec-1.12.0 → markdown_exec-1.12.1}/docs/.overrides/partials/comments.html +0 -0
- {markdown_exec-1.12.0 → markdown_exec-1.12.1}/docs/.overrides/partials/path-item.html +0 -0
- {markdown_exec-1.12.0 → markdown_exec-1.12.1}/docs/changelog.md +0 -0
- {markdown_exec-1.12.0 → markdown_exec-1.12.1}/docs/code_of_conduct.md +0 -0
- {markdown_exec-1.12.0 → markdown_exec-1.12.1}/docs/contributing.md +0 -0
- {markdown_exec-1.12.0 → markdown_exec-1.12.1}/docs/credits.md +0 -0
- {markdown_exec-1.12.0 → markdown_exec-1.12.1}/docs/css/material.css +0 -0
- {markdown_exec-1.12.0 → markdown_exec-1.12.1}/docs/css/mkdocstrings.css +0 -0
- {markdown_exec-1.12.0 → markdown_exec-1.12.1}/docs/gallery.md +0 -0
- {markdown_exec-1.12.0 → markdown_exec-1.12.1}/docs/index.md +0 -0
- {markdown_exec-1.12.0 → markdown_exec-1.12.1}/docs/js/feedback.js +0 -0
- {markdown_exec-1.12.0 → markdown_exec-1.12.1}/docs/license.md +0 -0
- {markdown_exec-1.12.0 → markdown_exec-1.12.1}/docs/reference/api.md +0 -0
- {markdown_exec-1.12.0 → markdown_exec-1.12.1}/docs/schema.json +0 -0
- {markdown_exec-1.12.0 → markdown_exec-1.12.1}/docs/snippets/gallery/ansi.sh +0 -0
- {markdown_exec-1.12.0 → markdown_exec-1.12.1}/docs/snippets/gallery/argparse.py +0 -0
- {markdown_exec-1.12.0 → markdown_exec-1.12.1}/docs/snippets/gallery/argparse_format.py +0 -0
- {markdown_exec-1.12.0 → markdown_exec-1.12.1}/docs/snippets/gallery/chalk.py +0 -0
- {markdown_exec-1.12.0 → markdown_exec-1.12.1}/docs/snippets/gallery/d2.py +0 -0
- {markdown_exec-1.12.0 → markdown_exec-1.12.1}/docs/snippets/gallery/diagrams.py +0 -0
- {markdown_exec-1.12.0 → markdown_exec-1.12.1}/docs/snippets/gallery/drawsvg.py +0 -0
- {markdown_exec-1.12.0 → markdown_exec-1.12.1}/docs/snippets/gallery/expandable_filetree.py +0 -0
- {markdown_exec-1.12.0 → markdown_exec-1.12.1}/docs/snippets/gallery/hyperbolic.py +0 -0
- {markdown_exec-1.12.0 → markdown_exec-1.12.1}/docs/snippets/gallery/matplotlib.py +0 -0
- {markdown_exec-1.12.0 → markdown_exec-1.12.1}/docs/snippets/gallery/plotly.py +0 -0
- {markdown_exec-1.12.0 → markdown_exec-1.12.1}/docs/snippets/gallery/pydeps.py +0 -0
- {markdown_exec-1.12.0 → markdown_exec-1.12.1}/docs/snippets/gallery/qrcode.py +0 -0
- {markdown_exec-1.12.0 → markdown_exec-1.12.1}/docs/snippets/gallery/rich.py +0 -0
- {markdown_exec-1.12.0 → markdown_exec-1.12.1}/docs/snippets/gallery/rich_terminal.py +0 -0
- {markdown_exec-1.12.0 → markdown_exec-1.12.1}/docs/snippets/gallery/runpy.py +0 -0
- {markdown_exec-1.12.0 → markdown_exec-1.12.1}/docs/snippets/gallery/textual.py +0 -0
- {markdown_exec-1.12.0 → markdown_exec-1.12.1}/docs/snippets/usage/boolean_matrix.py +0 -0
- {markdown_exec-1.12.0 → markdown_exec-1.12.1}/docs/snippets/usage/hide.py +0 -0
- {markdown_exec-1.12.0 → markdown_exec-1.12.1}/docs/snippets/usage/multiple.pycon +0 -0
- {markdown_exec-1.12.0 → markdown_exec-1.12.1}/docs/snippets/usage/platform_html.py +0 -0
- {markdown_exec-1.12.0 → markdown_exec-1.12.1}/docs/snippets/usage/platform_md.py +0 -0
- {markdown_exec-1.12.0 → markdown_exec-1.12.1}/docs/snippets/usage/source.py +0 -0
- {markdown_exec-1.12.0 → markdown_exec-1.12.1}/docs/snippets/usage/source.pycon +0 -0
- {markdown_exec-1.12.0 → markdown_exec-1.12.1}/docs/usage/index.md +0 -0
- {markdown_exec-1.12.0 → markdown_exec-1.12.1}/docs/usage/pyodide.md +0 -0
- {markdown_exec-1.12.0 → markdown_exec-1.12.1}/docs/usage/python.md +0 -0
- {markdown_exec-1.12.0 → markdown_exec-1.12.1}/docs/usage/shell.md +0 -0
- {markdown_exec-1.12.0 → markdown_exec-1.12.1}/docs/usage/tree.md +0 -0
- {markdown_exec-1.12.0 → markdown_exec-1.12.1}/duties.py +0 -0
- {markdown_exec-1.12.0 → markdown_exec-1.12.1}/mkdocs.yml +0 -0
- {markdown_exec-1.12.0 → markdown_exec-1.12.1}/scripts/gen_credits.py +0 -0
- {markdown_exec-1.12.0 → markdown_exec-1.12.1}/scripts/get_version.py +0 -0
- {markdown_exec-1.12.0 → markdown_exec-1.12.1}/scripts/make +0 -0
- {markdown_exec-1.12.0 → markdown_exec-1.12.1}/scripts/make.py +0 -0
- {markdown_exec-1.12.0 → markdown_exec-1.12.1}/src/markdown_exec/__init__.py +0 -0
- {markdown_exec-1.12.0 → markdown_exec-1.12.1}/src/markdown_exec/_internal/__init__.py +0 -0
- {markdown_exec-1.12.0 → markdown_exec-1.12.1}/src/markdown_exec/_internal/debug.py +0 -0
- {markdown_exec-1.12.0 → markdown_exec-1.12.1}/src/markdown_exec/_internal/formatters/__init__.py +0 -0
- {markdown_exec-1.12.0 → markdown_exec-1.12.1}/src/markdown_exec/_internal/formatters/_exec_python.py +0 -0
- {markdown_exec-1.12.0 → markdown_exec-1.12.1}/src/markdown_exec/_internal/formatters/base.py +0 -0
- {markdown_exec-1.12.0 → markdown_exec-1.12.1}/src/markdown_exec/_internal/formatters/bash.py +0 -0
- {markdown_exec-1.12.0 → markdown_exec-1.12.1}/src/markdown_exec/_internal/formatters/console.py +0 -0
- {markdown_exec-1.12.0 → markdown_exec-1.12.1}/src/markdown_exec/_internal/formatters/markdown.py +0 -0
- {markdown_exec-1.12.0 → markdown_exec-1.12.1}/src/markdown_exec/_internal/formatters/pycon.py +0 -0
- {markdown_exec-1.12.0 → markdown_exec-1.12.1}/src/markdown_exec/_internal/formatters/pyodide.py +0 -0
- {markdown_exec-1.12.0 → markdown_exec-1.12.1}/src/markdown_exec/_internal/formatters/python.py +0 -0
- {markdown_exec-1.12.0 → markdown_exec-1.12.1}/src/markdown_exec/_internal/formatters/sh.py +0 -0
- {markdown_exec-1.12.0 → markdown_exec-1.12.1}/src/markdown_exec/_internal/formatters/tree.py +0 -0
- {markdown_exec-1.12.0 → markdown_exec-1.12.1}/src/markdown_exec/_internal/logger.py +0 -0
- {markdown_exec-1.12.0 → markdown_exec-1.12.1}/src/markdown_exec/_internal/main.py +0 -0
- {markdown_exec-1.12.0 → markdown_exec-1.12.1}/src/markdown_exec/_internal/mkdocs_plugin.py +0 -0
- {markdown_exec-1.12.0 → markdown_exec-1.12.1}/src/markdown_exec/_internal/processors.py +0 -0
- {markdown_exec-1.12.0 → markdown_exec-1.12.1}/src/markdown_exec/assets/ansi.css +0 -0
- {markdown_exec-1.12.0 → markdown_exec-1.12.1}/src/markdown_exec/assets/pyodide.css +0 -0
- {markdown_exec-1.12.0 → markdown_exec-1.12.1}/src/markdown_exec/assets/pyodide.js +0 -0
- {markdown_exec-1.12.0 → markdown_exec-1.12.1}/src/markdown_exec/formatters/__init__.py +0 -0
- {markdown_exec-1.12.0 → markdown_exec-1.12.1}/src/markdown_exec/formatters/base.py +0 -0
- {markdown_exec-1.12.0 → markdown_exec-1.12.1}/src/markdown_exec/formatters/bash.py +0 -0
- {markdown_exec-1.12.0 → markdown_exec-1.12.1}/src/markdown_exec/formatters/console.py +0 -0
- {markdown_exec-1.12.0 → markdown_exec-1.12.1}/src/markdown_exec/formatters/markdown.py +0 -0
- {markdown_exec-1.12.0 → markdown_exec-1.12.1}/src/markdown_exec/formatters/pycon.py +0 -0
- {markdown_exec-1.12.0 → markdown_exec-1.12.1}/src/markdown_exec/formatters/pyodide.py +0 -0
- {markdown_exec-1.12.0 → markdown_exec-1.12.1}/src/markdown_exec/formatters/python.py +0 -0
- {markdown_exec-1.12.0 → markdown_exec-1.12.1}/src/markdown_exec/formatters/sh.py +0 -0
- {markdown_exec-1.12.0 → markdown_exec-1.12.1}/src/markdown_exec/formatters/tree.py +0 -0
- {markdown_exec-1.12.0 → markdown_exec-1.12.1}/src/markdown_exec/logger.py +0 -0
- {markdown_exec-1.12.0 → markdown_exec-1.12.1}/src/markdown_exec/mkdocs_plugin.py +0 -0
- {markdown_exec-1.12.0 → markdown_exec-1.12.1}/src/markdown_exec/processors.py +0 -0
- {markdown_exec-1.12.0 → markdown_exec-1.12.1}/src/markdown_exec/py.typed +0 -0
- {markdown_exec-1.12.0 → markdown_exec-1.12.1}/src/markdown_exec/rendering.py +0 -0
- {markdown_exec-1.12.0 → markdown_exec-1.12.1}/tests/__init__.py +0 -0
- {markdown_exec-1.12.0 → markdown_exec-1.12.1}/tests/conftest.py +0 -0
- {markdown_exec-1.12.0 → markdown_exec-1.12.1}/tests/test_api.py +0 -0
- {markdown_exec-1.12.0 → markdown_exec-1.12.1}/tests/test_base_formatter.py +0 -0
- {markdown_exec-1.12.0 → markdown_exec-1.12.1}/tests/test_converter.py +0 -0
- {markdown_exec-1.12.0 → markdown_exec-1.12.1}/tests/test_headings.py +0 -0
- {markdown_exec-1.12.0 → markdown_exec-1.12.1}/tests/test_python.py +0 -0
- {markdown_exec-1.12.0 → markdown_exec-1.12.1}/tests/test_shell.py +0 -0
- {markdown_exec-1.12.0 → markdown_exec-1.12.1}/tests/test_toc.py +0 -0
- {markdown_exec-1.12.0 → markdown_exec-1.12.1}/tests/test_tree.py +0 -0
- {markdown_exec-1.12.0 → markdown_exec-1.12.1}/tests/test_validator.py +0 -0
|
@@ -5,6 +5,14 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
|
|
5
5
|
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
|
6
6
|
|
|
7
7
|
<!-- insertion marker -->
|
|
8
|
+
## [1.12.1](https://github.com/pawamoy/markdown-exec/releases/tag/1.12.1) - 2025-11-11
|
|
9
|
+
|
|
10
|
+
<small>[Compare with 1.12.0](https://github.com/pawamoy/markdown-exec/compare/1.12.0...1.12.1)</small>
|
|
11
|
+
|
|
12
|
+
### Code Refactoring
|
|
13
|
+
|
|
14
|
+
- Always register tables extension, needed for Zensical ([1f95bf0](https://github.com/pawamoy/markdown-exec/commit/1f95bf0a8b4a056a14f737b9bada0acc11de5e02) by Timothée Mazzucotelli).
|
|
15
|
+
|
|
8
16
|
## [1.12.0](https://github.com/pawamoy/markdown-exec/releases/tag/1.12.0) - 2025-11-10
|
|
9
17
|
|
|
10
18
|
<small>[Compare with 1.11.0](https://github.com/pawamoy/markdown-exec/compare/1.11.0...1.12.0)</small>
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: markdown-exec
|
|
3
|
+
Version: 1.12.1
|
|
4
|
+
Summary: Utilities to execute code blocks in Markdown files.
|
|
5
|
+
Keywords: markdown,python,exec,shell,bash,mkdocs
|
|
6
|
+
Author-Email: =?utf-8?q?Timoth=C3=A9e_Mazzucotelli?= <dev@pawamoy.fr>
|
|
7
|
+
License-Expression: ISC
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Classifier: Development Status :: 4 - Beta
|
|
10
|
+
Classifier: Intended Audience :: Developers
|
|
11
|
+
Classifier: Programming Language :: Python
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
19
|
+
Classifier: Topic :: Documentation
|
|
20
|
+
Classifier: Topic :: Software Development
|
|
21
|
+
Classifier: Topic :: Utilities
|
|
22
|
+
Classifier: Typing :: Typed
|
|
23
|
+
Project-URL: Homepage, https://pawamoy.github.io/markdown-exec
|
|
24
|
+
Project-URL: Documentation, https://pawamoy.github.io/markdown-exec
|
|
25
|
+
Project-URL: Changelog, https://pawamoy.github.io/markdown-exec/changelog
|
|
26
|
+
Project-URL: Repository, https://github.com/pawamoy/markdown-exec
|
|
27
|
+
Project-URL: Issues, https://github.com/pawamoy/markdown-exec/issues
|
|
28
|
+
Project-URL: Discussions, https://github.com/pawamoy/markdown-exec/discussions
|
|
29
|
+
Project-URL: Gitter, https://gitter.im/markdown-exec/community
|
|
30
|
+
Project-URL: Funding, https://github.com/sponsors/pawamoy
|
|
31
|
+
Requires-Python: >=3.10
|
|
32
|
+
Requires-Dist: pymdown-extensions>=9
|
|
33
|
+
Provides-Extra: ansi
|
|
34
|
+
Requires-Dist: pygments-ansi-color>=0.3; extra == "ansi"
|
|
35
|
+
Description-Content-Type: text/markdown
|
|
36
|
+
|
|
37
|
+
# Markdown Exec
|
|
38
|
+
|
|
39
|
+
[](https://github.com/pawamoy/markdown-exec/actions?query=workflow%3Aci)
|
|
40
|
+
[](https://pawamoy.github.io/markdown-exec/)
|
|
41
|
+
[](https://pypi.org/project/markdown-exec/)
|
|
42
|
+
[](https://app.gitter.im/#/room/#markdown-exec:gitter.im)
|
|
43
|
+
[](https://app.radicle.at/nodes/seed.radicle.at/rad:z77aiLJkzYXtuNpZuvizfGkDuZbQ)
|
|
44
|
+
|
|
45
|
+
Utilities to execute code blocks in Markdown files.
|
|
46
|
+
|
|
47
|
+
For example, you write a Python code block that computes some HTML,
|
|
48
|
+
and this HTML is injected in place of the code block.
|
|
49
|
+
|
|
50
|
+
## Installation
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
pip install "markdown-exec[ansi]"
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
The `ansi` extra provides the necessary bits (`pygments-ansi-color` and a CSS file)
|
|
57
|
+
to render ANSI colors in HTML code blocks. The CSS file is automatically added
|
|
58
|
+
to MkDocs' `extra_css` when Markdown Exec is activated via `plugins` (see below).
|
|
59
|
+
|
|
60
|
+
## Configuration
|
|
61
|
+
|
|
62
|
+
This extension relies on the
|
|
63
|
+
[SuperFences](https://facelessuser.github.io/pymdown-extensions/extensions/superfences/)
|
|
64
|
+
extension of
|
|
65
|
+
[PyMdown Extensions](https://facelessuser.github.io/pymdown-extensions/).
|
|
66
|
+
|
|
67
|
+
To allow execution of code blocks,
|
|
68
|
+
configure a custom fence from Python:
|
|
69
|
+
|
|
70
|
+
```python
|
|
71
|
+
from markdown import Markdown
|
|
72
|
+
from markdown_exec import formatter, validator
|
|
73
|
+
|
|
74
|
+
Markdown(
|
|
75
|
+
extensions=["pymdownx.superfences"],
|
|
76
|
+
extension_configs={
|
|
77
|
+
"pymdownx.superfences": {
|
|
78
|
+
"custom_fences": [
|
|
79
|
+
{
|
|
80
|
+
"name": "python",
|
|
81
|
+
"class": "python",
|
|
82
|
+
"validator": validator,
|
|
83
|
+
"format": formatter,
|
|
84
|
+
}
|
|
85
|
+
# ...one fence for each language we support:
|
|
86
|
+
# bash, console, md, markdown, py, python, pycon, pyodide, sh, tree, etc.
|
|
87
|
+
]
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
)
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
...or in MkDocs configuration file, as a Markdown extension:
|
|
94
|
+
|
|
95
|
+
```yaml
|
|
96
|
+
# mkdocs.yml
|
|
97
|
+
markdown_extensions:
|
|
98
|
+
- pymdownx.superfences:
|
|
99
|
+
custom_fences:
|
|
100
|
+
- name: python
|
|
101
|
+
class: python
|
|
102
|
+
validator: !!python/name:markdown_exec.validator
|
|
103
|
+
format: !!python/name:markdown_exec.formatter
|
|
104
|
+
# ...one fence for each language we support:
|
|
105
|
+
# bash, console, md, markdown, py, python, pycon, sh, tree
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
...or in MkDocs configuration file, as a plugin:
|
|
109
|
+
|
|
110
|
+
```yaml
|
|
111
|
+
# mkdocs.yml
|
|
112
|
+
plugins:
|
|
113
|
+
- search
|
|
114
|
+
- markdown-exec
|
|
115
|
+
|
|
116
|
+
# SuperFences must still be enabled!
|
|
117
|
+
markdown_extensions:
|
|
118
|
+
- pymdownx.superfences
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
TIP: We recommend enabling Markdown Exec with the MkDocs plugin
|
|
122
|
+
if you are using MkDocs: it will take care of adding relevant
|
|
123
|
+
assets (CSS/JS) to the final site when needed.
|
|
124
|
+
|
|
125
|
+
WARNING: **Limitation of configuration through Markdown/PyMDown.**
|
|
126
|
+
Configuration through `pymdownx.superfences` directly is not well supported for fences that require assets inclusion, like `pyodide`.
|
|
127
|
+
For these you will have to include the assets manually. In the future we will provide ways to include them automatically.
|
|
128
|
+
|
|
129
|
+
## Usage
|
|
130
|
+
|
|
131
|
+
You are now able to execute code blocks instead of displaying them:
|
|
132
|
+
|
|
133
|
+
````md
|
|
134
|
+
```python exec="on"
|
|
135
|
+
print("Hello Markdown!")
|
|
136
|
+
```
|
|
137
|
+
````
|
|
138
|
+
|
|
139
|
+
The `exec` option will be true for every possible value except `0`, `no`, `off` and `false` (case insensitive).
|
|
140
|
+
|
|
141
|
+
Below you can see an example of running a bash script that is expected to
|
|
142
|
+
return a non-zero exit code:
|
|
143
|
+
|
|
144
|
+
````md
|
|
145
|
+
```bash exec="1" source="tabbed-left" returncode="2"
|
|
146
|
+
grep extra_css README.md && exit 2
|
|
147
|
+
```
|
|
148
|
+
````
|
|
149
|
+
|
|
150
|
+
See [usage](https://pawamoy.github.io/markdown-exec/usage/) for more details,
|
|
151
|
+
and the [gallery](https://pawamoy.github.io/markdown-exec/gallery/) for more examples!
|
|
152
|
+
|
|
153
|
+
## Sponsors
|
|
154
|
+
|
|
155
|
+
<!-- sponsors-start -->
|
|
156
|
+
|
|
157
|
+
<div id="premium-sponsors" style="text-align: center;">
|
|
158
|
+
|
|
159
|
+
<div id="silver-sponsors"><b>Silver sponsors</b><p>
|
|
160
|
+
<a href="https://squidfunk.github.io/mkdocs-material/"><img alt="Material for MkDocs" src="https://raw.githubusercontent.com/squidfunk/mkdocs-material/master/.github/assets/logo.svg" style="height: 320px; "></a><br>
|
|
161
|
+
<a href="https://fastapi.tiangolo.com/"><img alt="FastAPI" src="https://raw.githubusercontent.com/tiangolo/fastapi/master/docs/en/docs/img/logo-margin/logo-teal.png" style="height: 200px; "></a><br>
|
|
162
|
+
<a href="https://docs.pydantic.dev/latest/"><img alt="Pydantic" src="https://pydantic.dev/assets/for-external/pydantic_logfire_logo_endorsed_lithium_rgb.svg" style="height: 180px; "></a><br>
|
|
163
|
+
</p></div>
|
|
164
|
+
|
|
165
|
+
<div id="bronze-sponsors"><b>Bronze sponsors</b><p>
|
|
166
|
+
<a href="https://www.nixtla.io/"><picture><source media="(prefers-color-scheme: light)" srcset="https://www.nixtla.io/img/logo/full-black.svg"><source media="(prefers-color-scheme: dark)" srcset="https://www.nixtla.io/img/logo/full-white.svg"><img alt="Nixtla" src="https://www.nixtla.io/img/logo/full-black.svg" style="height: 60px; "></picture></a><br>
|
|
167
|
+
</p></div>
|
|
168
|
+
</div>
|
|
169
|
+
|
|
170
|
+
---
|
|
171
|
+
|
|
172
|
+
<div id="sponsors"><p>
|
|
173
|
+
<a href="https://github.com/ofek"><img alt="ofek" src="https://avatars.githubusercontent.com/u/9677399?u=386c330f212ce467ce7119d9615c75d0e9b9f1ce&v=4" style="height: 32px; border-radius: 100%;"></a>
|
|
174
|
+
<a href="https://github.com/samuelcolvin"><img alt="samuelcolvin" src="https://avatars.githubusercontent.com/u/4039449?u=42eb3b833047c8c4b4f647a031eaef148c16d93f&v=4" style="height: 32px; border-radius: 100%;"></a>
|
|
175
|
+
<a href="https://github.com/tlambert03"><img alt="tlambert03" src="https://avatars.githubusercontent.com/u/1609449?u=922abf0524b47739b37095e553c99488814b05db&v=4" style="height: 32px; border-radius: 100%;"></a>
|
|
176
|
+
<a href="https://github.com/ssbarnea"><img alt="ssbarnea" src="https://avatars.githubusercontent.com/u/102495?u=c7bd9ddf127785286fc939dd18cb02db0a453bce&v=4" style="height: 32px; border-radius: 100%;"></a>
|
|
177
|
+
<a href="https://github.com/femtomc"><img alt="femtomc" src="https://avatars.githubusercontent.com/u/34410036?u=f13a71daf2a9f0d2da189beaa94250daa629e2d8&v=4" style="height: 32px; border-radius: 100%;"></a>
|
|
178
|
+
<a href="https://github.com/cmarqu"><img alt="cmarqu" src="https://avatars.githubusercontent.com/u/360986?v=4" style="height: 32px; border-radius: 100%;"></a>
|
|
179
|
+
<a href="https://github.com/kolenaIO"><img alt="kolenaIO" src="https://avatars.githubusercontent.com/u/77010818?v=4" style="height: 32px; border-radius: 100%;"></a>
|
|
180
|
+
<a href="https://github.com/ramnes"><img alt="ramnes" src="https://avatars.githubusercontent.com/u/835072?u=3fca03c3ba0051e2eb652b1def2188a94d1e1dc2&v=4" style="height: 32px; border-radius: 100%;"></a>
|
|
181
|
+
<a href="https://github.com/machow"><img alt="machow" src="https://avatars.githubusercontent.com/u/2574498?u=c41e3d2f758a05102d8075e38d67b9c17d4189d7&v=4" style="height: 32px; border-radius: 100%;"></a>
|
|
182
|
+
<a href="https://github.com/BenHammersley"><img alt="BenHammersley" src="https://avatars.githubusercontent.com/u/99436?u=4499a7b507541045222ee28ae122dbe3c8d08ab5&v=4" style="height: 32px; border-radius: 100%;"></a>
|
|
183
|
+
<a href="https://github.com/trevorWieland"><img alt="trevorWieland" src="https://avatars.githubusercontent.com/u/28811461?u=74cc0e3756c1d4e3d66b5c396e1d131ea8a10472&v=4" style="height: 32px; border-radius: 100%;"></a>
|
|
184
|
+
<a href="https://github.com/laenan8466"><img alt="laenan8466" src="https://avatars.githubusercontent.com/u/21331242?v=4" style="height: 32px; border-radius: 100%;"></a>
|
|
185
|
+
<a href="https://github.com/MarcoGorelli"><img alt="MarcoGorelli" src="https://avatars.githubusercontent.com/u/33491632?u=7de3a749cac76a60baca9777baf71d043a4f884d&v=4" style="height: 32px; border-radius: 100%;"></a>
|
|
186
|
+
<a href="https://github.com/analog-cbarber"><img alt="analog-cbarber" src="https://avatars.githubusercontent.com/u/7408243?u=642fc2bdcc9904089c62fe5aec4e03ace32da67d&v=4" style="height: 32px; border-radius: 100%;"></a>
|
|
187
|
+
<a href="https://github.com/OdinManiac"><img alt="OdinManiac" src="https://avatars.githubusercontent.com/u/22727172?u=36ab20970f7f52ae8e7eb67b7fcf491fee01ac22&v=4" style="height: 32px; border-radius: 100%;"></a>
|
|
188
|
+
<a href="https://github.com/rstudio-sponsorship"><img alt="rstudio-sponsorship" src="https://avatars.githubusercontent.com/u/58949051?u=0c471515dd18111be30dfb7669ed5e778970959b&v=4" style="height: 32px; border-radius: 100%;"></a>
|
|
189
|
+
<a href="https://github.com/schlich"><img alt="schlich" src="https://avatars.githubusercontent.com/u/21191435?u=6f1240adb68f21614d809ae52d66509f46b1e877&v=4" style="height: 32px; border-radius: 100%;"></a>
|
|
190
|
+
<a href="https://github.com/SuperCowPowers"><img alt="SuperCowPowers" src="https://avatars.githubusercontent.com/u/6900187?v=4" style="height: 32px; border-radius: 100%;"></a>
|
|
191
|
+
<a href="https://github.com/butterlyn"><img alt="butterlyn" src="https://avatars.githubusercontent.com/u/53323535?v=4" style="height: 32px; border-radius: 100%;"></a>
|
|
192
|
+
<a href="https://github.com/livingbio"><img alt="livingbio" src="https://avatars.githubusercontent.com/u/10329983?v=4" style="height: 32px; border-radius: 100%;"></a>
|
|
193
|
+
<a href="https://github.com/NemetschekAllplan"><img alt="NemetschekAllplan" src="https://avatars.githubusercontent.com/u/912034?v=4" style="height: 32px; border-radius: 100%;"></a>
|
|
194
|
+
<a href="https://github.com/EricJayHartman"><img alt="EricJayHartman" src="https://avatars.githubusercontent.com/u/9259499?u=7e58cc7ec0cd3e85b27aec33656aa0f6612706dd&v=4" style="height: 32px; border-radius: 100%;"></a>
|
|
195
|
+
<a href="https://github.com/15r10nk"><img alt="15r10nk" src="https://avatars.githubusercontent.com/u/44680962?u=f04826446ff165742efa81e314bd03bf1724d50e&v=4" style="height: 32px; border-radius: 100%;"></a>
|
|
196
|
+
<a href="https://github.com/cdwilson"><img alt="cdwilson" src="https://avatars.githubusercontent.com/u/14631?v=4" style="height: 32px; border-radius: 100%;"></a>
|
|
197
|
+
<a href="https://github.com/activeloopai"><img alt="activeloopai" src="https://avatars.githubusercontent.com/u/34816118?v=4" style="height: 32px; border-radius: 100%;"></a>
|
|
198
|
+
<a href="https://github.com/roboflow"><img alt="roboflow" src="https://avatars.githubusercontent.com/u/53104118?v=4" style="height: 32px; border-radius: 100%;"></a>
|
|
199
|
+
<a href="https://github.com/wrath-codes"><img alt="wrath-codes" src="https://avatars.githubusercontent.com/u/90050913?u=b26582409dfff8ce2b60016fd119be09309708da&v=4" style="height: 32px; border-radius: 100%;"></a>
|
|
200
|
+
<a href="https://github.com/leodevian"><img alt="leodevian" src="https://avatars.githubusercontent.com/u/167141781?v=4" style="height: 32px; border-radius: 100%;"></a>
|
|
201
|
+
<a href="https://github.com/cmclaughlin"><img alt="cmclaughlin" src="https://avatars.githubusercontent.com/u/1061109?u=ddf6eec0edd2d11c980f8c3aa96e3d044d4e0468&v=4" style="height: 32px; border-radius: 100%;"></a>
|
|
202
|
+
<a href="https://github.com/blaisep"><img alt="blaisep" src="https://avatars.githubusercontent.com/u/254456?u=97d584b7c0a6faf583aa59975df4f993f671d121&v=4" style="height: 32px; border-radius: 100%;"></a>
|
|
203
|
+
<a href="https://github.com/RapidataAI"><img alt="RapidataAI" src="https://avatars.githubusercontent.com/u/104209891?v=4" style="height: 32px; border-radius: 100%;"></a>
|
|
204
|
+
<a href="https://github.com/rodolphebarbanneau"><img alt="rodolphebarbanneau" src="https://avatars.githubusercontent.com/u/46493454?u=6c405452a40c231cdf0b68e97544e07ee956a733&v=4" style="height: 32px; border-radius: 100%;"></a>
|
|
205
|
+
<a href="https://github.com/theSymbolSyndicate"><img alt="theSymbolSyndicate" src="https://avatars.githubusercontent.com/u/111542255?v=4" style="height: 32px; border-radius: 100%;"></a>
|
|
206
|
+
<a href="https://github.com/blakeNaccarato"><img alt="blakeNaccarato" src="https://avatars.githubusercontent.com/u/20692450?u=bb919218be30cfa994514f4cf39bb2f7cf952df4&v=4" style="height: 32px; border-radius: 100%;"></a>
|
|
207
|
+
<a href="https://github.com/ChargeStorm"><img alt="ChargeStorm" src="https://avatars.githubusercontent.com/u/26000165?v=4" style="height: 32px; border-radius: 100%;"></a>
|
|
208
|
+
<a href="https://github.com/Alphadelta14"><img alt="Alphadelta14" src="https://avatars.githubusercontent.com/u/480845?v=4" style="height: 32px; border-radius: 100%;"></a>
|
|
209
|
+
</p></div>
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
*And 8 more private sponsor(s).*
|
|
213
|
+
|
|
214
|
+
<!-- sponsors-end -->
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
# Markdown Exec
|
|
2
|
+
|
|
3
|
+
[](https://github.com/pawamoy/markdown-exec/actions?query=workflow%3Aci)
|
|
4
|
+
[](https://pawamoy.github.io/markdown-exec/)
|
|
5
|
+
[](https://pypi.org/project/markdown-exec/)
|
|
6
|
+
[](https://app.gitter.im/#/room/#markdown-exec:gitter.im)
|
|
7
|
+
[](https://app.radicle.at/nodes/seed.radicle.at/rad:z77aiLJkzYXtuNpZuvizfGkDuZbQ)
|
|
8
|
+
|
|
9
|
+
Utilities to execute code blocks in Markdown files.
|
|
10
|
+
|
|
11
|
+
For example, you write a Python code block that computes some HTML,
|
|
12
|
+
and this HTML is injected in place of the code block.
|
|
13
|
+
|
|
14
|
+
## Installation
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
pip install "markdown-exec[ansi]"
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
The `ansi` extra provides the necessary bits (`pygments-ansi-color` and a CSS file)
|
|
21
|
+
to render ANSI colors in HTML code blocks. The CSS file is automatically added
|
|
22
|
+
to MkDocs' `extra_css` when Markdown Exec is activated via `plugins` (see below).
|
|
23
|
+
|
|
24
|
+
## Configuration
|
|
25
|
+
|
|
26
|
+
This extension relies on the
|
|
27
|
+
[SuperFences](https://facelessuser.github.io/pymdown-extensions/extensions/superfences/)
|
|
28
|
+
extension of
|
|
29
|
+
[PyMdown Extensions](https://facelessuser.github.io/pymdown-extensions/).
|
|
30
|
+
|
|
31
|
+
To allow execution of code blocks,
|
|
32
|
+
configure a custom fence from Python:
|
|
33
|
+
|
|
34
|
+
```python
|
|
35
|
+
from markdown import Markdown
|
|
36
|
+
from markdown_exec import formatter, validator
|
|
37
|
+
|
|
38
|
+
Markdown(
|
|
39
|
+
extensions=["pymdownx.superfences"],
|
|
40
|
+
extension_configs={
|
|
41
|
+
"pymdownx.superfences": {
|
|
42
|
+
"custom_fences": [
|
|
43
|
+
{
|
|
44
|
+
"name": "python",
|
|
45
|
+
"class": "python",
|
|
46
|
+
"validator": validator,
|
|
47
|
+
"format": formatter,
|
|
48
|
+
}
|
|
49
|
+
# ...one fence for each language we support:
|
|
50
|
+
# bash, console, md, markdown, py, python, pycon, pyodide, sh, tree, etc.
|
|
51
|
+
]
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
)
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
...or in MkDocs configuration file, as a Markdown extension:
|
|
58
|
+
|
|
59
|
+
```yaml
|
|
60
|
+
# mkdocs.yml
|
|
61
|
+
markdown_extensions:
|
|
62
|
+
- pymdownx.superfences:
|
|
63
|
+
custom_fences:
|
|
64
|
+
- name: python
|
|
65
|
+
class: python
|
|
66
|
+
validator: !!python/name:markdown_exec.validator
|
|
67
|
+
format: !!python/name:markdown_exec.formatter
|
|
68
|
+
# ...one fence for each language we support:
|
|
69
|
+
# bash, console, md, markdown, py, python, pycon, sh, tree
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
...or in MkDocs configuration file, as a plugin:
|
|
73
|
+
|
|
74
|
+
```yaml
|
|
75
|
+
# mkdocs.yml
|
|
76
|
+
plugins:
|
|
77
|
+
- search
|
|
78
|
+
- markdown-exec
|
|
79
|
+
|
|
80
|
+
# SuperFences must still be enabled!
|
|
81
|
+
markdown_extensions:
|
|
82
|
+
- pymdownx.superfences
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
TIP: We recommend enabling Markdown Exec with the MkDocs plugin
|
|
86
|
+
if you are using MkDocs: it will take care of adding relevant
|
|
87
|
+
assets (CSS/JS) to the final site when needed.
|
|
88
|
+
|
|
89
|
+
WARNING: **Limitation of configuration through Markdown/PyMDown.**
|
|
90
|
+
Configuration through `pymdownx.superfences` directly is not well supported for fences that require assets inclusion, like `pyodide`.
|
|
91
|
+
For these you will have to include the assets manually. In the future we will provide ways to include them automatically.
|
|
92
|
+
|
|
93
|
+
## Usage
|
|
94
|
+
|
|
95
|
+
You are now able to execute code blocks instead of displaying them:
|
|
96
|
+
|
|
97
|
+
````md
|
|
98
|
+
```python exec="on"
|
|
99
|
+
print("Hello Markdown!")
|
|
100
|
+
```
|
|
101
|
+
````
|
|
102
|
+
|
|
103
|
+
The `exec` option will be true for every possible value except `0`, `no`, `off` and `false` (case insensitive).
|
|
104
|
+
|
|
105
|
+
Below you can see an example of running a bash script that is expected to
|
|
106
|
+
return a non-zero exit code:
|
|
107
|
+
|
|
108
|
+
````md
|
|
109
|
+
```bash exec="1" source="tabbed-left" returncode="2"
|
|
110
|
+
grep extra_css README.md && exit 2
|
|
111
|
+
```
|
|
112
|
+
````
|
|
113
|
+
|
|
114
|
+
See [usage](https://pawamoy.github.io/markdown-exec/usage/) for more details,
|
|
115
|
+
and the [gallery](https://pawamoy.github.io/markdown-exec/gallery/) for more examples!
|
|
116
|
+
|
|
117
|
+
## Sponsors
|
|
118
|
+
|
|
119
|
+
<!-- sponsors-start -->
|
|
120
|
+
|
|
121
|
+
<div id="premium-sponsors" style="text-align: center;">
|
|
122
|
+
|
|
123
|
+
<div id="silver-sponsors"><b>Silver sponsors</b><p>
|
|
124
|
+
<a href="https://squidfunk.github.io/mkdocs-material/"><img alt="Material for MkDocs" src="https://raw.githubusercontent.com/squidfunk/mkdocs-material/master/.github/assets/logo.svg" style="height: 320px; "></a><br>
|
|
125
|
+
<a href="https://fastapi.tiangolo.com/"><img alt="FastAPI" src="https://raw.githubusercontent.com/tiangolo/fastapi/master/docs/en/docs/img/logo-margin/logo-teal.png" style="height: 200px; "></a><br>
|
|
126
|
+
<a href="https://docs.pydantic.dev/latest/"><img alt="Pydantic" src="https://pydantic.dev/assets/for-external/pydantic_logfire_logo_endorsed_lithium_rgb.svg" style="height: 180px; "></a><br>
|
|
127
|
+
</p></div>
|
|
128
|
+
|
|
129
|
+
<div id="bronze-sponsors"><b>Bronze sponsors</b><p>
|
|
130
|
+
<a href="https://www.nixtla.io/"><picture><source media="(prefers-color-scheme: light)" srcset="https://www.nixtla.io/img/logo/full-black.svg"><source media="(prefers-color-scheme: dark)" srcset="https://www.nixtla.io/img/logo/full-white.svg"><img alt="Nixtla" src="https://www.nixtla.io/img/logo/full-black.svg" style="height: 60px; "></picture></a><br>
|
|
131
|
+
</p></div>
|
|
132
|
+
</div>
|
|
133
|
+
|
|
134
|
+
---
|
|
135
|
+
|
|
136
|
+
<div id="sponsors"><p>
|
|
137
|
+
<a href="https://github.com/ofek"><img alt="ofek" src="https://avatars.githubusercontent.com/u/9677399?u=386c330f212ce467ce7119d9615c75d0e9b9f1ce&v=4" style="height: 32px; border-radius: 100%;"></a>
|
|
138
|
+
<a href="https://github.com/samuelcolvin"><img alt="samuelcolvin" src="https://avatars.githubusercontent.com/u/4039449?u=42eb3b833047c8c4b4f647a031eaef148c16d93f&v=4" style="height: 32px; border-radius: 100%;"></a>
|
|
139
|
+
<a href="https://github.com/tlambert03"><img alt="tlambert03" src="https://avatars.githubusercontent.com/u/1609449?u=922abf0524b47739b37095e553c99488814b05db&v=4" style="height: 32px; border-radius: 100%;"></a>
|
|
140
|
+
<a href="https://github.com/ssbarnea"><img alt="ssbarnea" src="https://avatars.githubusercontent.com/u/102495?u=c7bd9ddf127785286fc939dd18cb02db0a453bce&v=4" style="height: 32px; border-radius: 100%;"></a>
|
|
141
|
+
<a href="https://github.com/femtomc"><img alt="femtomc" src="https://avatars.githubusercontent.com/u/34410036?u=f13a71daf2a9f0d2da189beaa94250daa629e2d8&v=4" style="height: 32px; border-radius: 100%;"></a>
|
|
142
|
+
<a href="https://github.com/cmarqu"><img alt="cmarqu" src="https://avatars.githubusercontent.com/u/360986?v=4" style="height: 32px; border-radius: 100%;"></a>
|
|
143
|
+
<a href="https://github.com/kolenaIO"><img alt="kolenaIO" src="https://avatars.githubusercontent.com/u/77010818?v=4" style="height: 32px; border-radius: 100%;"></a>
|
|
144
|
+
<a href="https://github.com/ramnes"><img alt="ramnes" src="https://avatars.githubusercontent.com/u/835072?u=3fca03c3ba0051e2eb652b1def2188a94d1e1dc2&v=4" style="height: 32px; border-radius: 100%;"></a>
|
|
145
|
+
<a href="https://github.com/machow"><img alt="machow" src="https://avatars.githubusercontent.com/u/2574498?u=c41e3d2f758a05102d8075e38d67b9c17d4189d7&v=4" style="height: 32px; border-radius: 100%;"></a>
|
|
146
|
+
<a href="https://github.com/BenHammersley"><img alt="BenHammersley" src="https://avatars.githubusercontent.com/u/99436?u=4499a7b507541045222ee28ae122dbe3c8d08ab5&v=4" style="height: 32px; border-radius: 100%;"></a>
|
|
147
|
+
<a href="https://github.com/trevorWieland"><img alt="trevorWieland" src="https://avatars.githubusercontent.com/u/28811461?u=74cc0e3756c1d4e3d66b5c396e1d131ea8a10472&v=4" style="height: 32px; border-radius: 100%;"></a>
|
|
148
|
+
<a href="https://github.com/laenan8466"><img alt="laenan8466" src="https://avatars.githubusercontent.com/u/21331242?v=4" style="height: 32px; border-radius: 100%;"></a>
|
|
149
|
+
<a href="https://github.com/MarcoGorelli"><img alt="MarcoGorelli" src="https://avatars.githubusercontent.com/u/33491632?u=7de3a749cac76a60baca9777baf71d043a4f884d&v=4" style="height: 32px; border-radius: 100%;"></a>
|
|
150
|
+
<a href="https://github.com/analog-cbarber"><img alt="analog-cbarber" src="https://avatars.githubusercontent.com/u/7408243?u=642fc2bdcc9904089c62fe5aec4e03ace32da67d&v=4" style="height: 32px; border-radius: 100%;"></a>
|
|
151
|
+
<a href="https://github.com/OdinManiac"><img alt="OdinManiac" src="https://avatars.githubusercontent.com/u/22727172?u=36ab20970f7f52ae8e7eb67b7fcf491fee01ac22&v=4" style="height: 32px; border-radius: 100%;"></a>
|
|
152
|
+
<a href="https://github.com/rstudio-sponsorship"><img alt="rstudio-sponsorship" src="https://avatars.githubusercontent.com/u/58949051?u=0c471515dd18111be30dfb7669ed5e778970959b&v=4" style="height: 32px; border-radius: 100%;"></a>
|
|
153
|
+
<a href="https://github.com/schlich"><img alt="schlich" src="https://avatars.githubusercontent.com/u/21191435?u=6f1240adb68f21614d809ae52d66509f46b1e877&v=4" style="height: 32px; border-radius: 100%;"></a>
|
|
154
|
+
<a href="https://github.com/SuperCowPowers"><img alt="SuperCowPowers" src="https://avatars.githubusercontent.com/u/6900187?v=4" style="height: 32px; border-radius: 100%;"></a>
|
|
155
|
+
<a href="https://github.com/butterlyn"><img alt="butterlyn" src="https://avatars.githubusercontent.com/u/53323535?v=4" style="height: 32px; border-radius: 100%;"></a>
|
|
156
|
+
<a href="https://github.com/livingbio"><img alt="livingbio" src="https://avatars.githubusercontent.com/u/10329983?v=4" style="height: 32px; border-radius: 100%;"></a>
|
|
157
|
+
<a href="https://github.com/NemetschekAllplan"><img alt="NemetschekAllplan" src="https://avatars.githubusercontent.com/u/912034?v=4" style="height: 32px; border-radius: 100%;"></a>
|
|
158
|
+
<a href="https://github.com/EricJayHartman"><img alt="EricJayHartman" src="https://avatars.githubusercontent.com/u/9259499?u=7e58cc7ec0cd3e85b27aec33656aa0f6612706dd&v=4" style="height: 32px; border-radius: 100%;"></a>
|
|
159
|
+
<a href="https://github.com/15r10nk"><img alt="15r10nk" src="https://avatars.githubusercontent.com/u/44680962?u=f04826446ff165742efa81e314bd03bf1724d50e&v=4" style="height: 32px; border-radius: 100%;"></a>
|
|
160
|
+
<a href="https://github.com/cdwilson"><img alt="cdwilson" src="https://avatars.githubusercontent.com/u/14631?v=4" style="height: 32px; border-radius: 100%;"></a>
|
|
161
|
+
<a href="https://github.com/activeloopai"><img alt="activeloopai" src="https://avatars.githubusercontent.com/u/34816118?v=4" style="height: 32px; border-radius: 100%;"></a>
|
|
162
|
+
<a href="https://github.com/roboflow"><img alt="roboflow" src="https://avatars.githubusercontent.com/u/53104118?v=4" style="height: 32px; border-radius: 100%;"></a>
|
|
163
|
+
<a href="https://github.com/wrath-codes"><img alt="wrath-codes" src="https://avatars.githubusercontent.com/u/90050913?u=b26582409dfff8ce2b60016fd119be09309708da&v=4" style="height: 32px; border-radius: 100%;"></a>
|
|
164
|
+
<a href="https://github.com/leodevian"><img alt="leodevian" src="https://avatars.githubusercontent.com/u/167141781?v=4" style="height: 32px; border-radius: 100%;"></a>
|
|
165
|
+
<a href="https://github.com/cmclaughlin"><img alt="cmclaughlin" src="https://avatars.githubusercontent.com/u/1061109?u=ddf6eec0edd2d11c980f8c3aa96e3d044d4e0468&v=4" style="height: 32px; border-radius: 100%;"></a>
|
|
166
|
+
<a href="https://github.com/blaisep"><img alt="blaisep" src="https://avatars.githubusercontent.com/u/254456?u=97d584b7c0a6faf583aa59975df4f993f671d121&v=4" style="height: 32px; border-radius: 100%;"></a>
|
|
167
|
+
<a href="https://github.com/RapidataAI"><img alt="RapidataAI" src="https://avatars.githubusercontent.com/u/104209891?v=4" style="height: 32px; border-radius: 100%;"></a>
|
|
168
|
+
<a href="https://github.com/rodolphebarbanneau"><img alt="rodolphebarbanneau" src="https://avatars.githubusercontent.com/u/46493454?u=6c405452a40c231cdf0b68e97544e07ee956a733&v=4" style="height: 32px; border-radius: 100%;"></a>
|
|
169
|
+
<a href="https://github.com/theSymbolSyndicate"><img alt="theSymbolSyndicate" src="https://avatars.githubusercontent.com/u/111542255?v=4" style="height: 32px; border-radius: 100%;"></a>
|
|
170
|
+
<a href="https://github.com/blakeNaccarato"><img alt="blakeNaccarato" src="https://avatars.githubusercontent.com/u/20692450?u=bb919218be30cfa994514f4cf39bb2f7cf952df4&v=4" style="height: 32px; border-radius: 100%;"></a>
|
|
171
|
+
<a href="https://github.com/ChargeStorm"><img alt="ChargeStorm" src="https://avatars.githubusercontent.com/u/26000165?v=4" style="height: 32px; border-radius: 100%;"></a>
|
|
172
|
+
<a href="https://github.com/Alphadelta14"><img alt="Alphadelta14" src="https://avatars.githubusercontent.com/u/480845?v=4" style="height: 32px; border-radius: 100%;"></a>
|
|
173
|
+
</p></div>
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
*And 8 more private sponsor(s).*
|
|
177
|
+
|
|
178
|
+
<!-- sponsors-end -->
|
|
@@ -202,6 +202,11 @@ def _mimic(md: Markdown, headings: list[Element], *, update_toc: bool = True) ->
|
|
|
202
202
|
new_md = Markdown()
|
|
203
203
|
extensions: list[Extension | str] = markdown_config.exts or md.registeredExtensions # type: ignore[assignment]
|
|
204
204
|
extensions_config: dict[str, dict[str, Any]] = markdown_config.exts_config or {}
|
|
205
|
+
|
|
206
|
+
# Needed for Zensical.
|
|
207
|
+
if "tables" not in extensions:
|
|
208
|
+
extensions.append("tables")
|
|
209
|
+
|
|
205
210
|
new_md.registerExtensions(extensions, extensions_config)
|
|
206
211
|
new_md.treeprocessors.register(
|
|
207
212
|
IdPrependingTreeprocessor(md, ""),
|
markdown_exec-1.12.0/PKG-INFO
DELETED
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: markdown-exec
|
|
3
|
-
Version: 1.12.0
|
|
4
|
-
Summary: Utilities to execute code blocks in Markdown files.
|
|
5
|
-
Keywords: markdown,python,exec,shell,bash,mkdocs
|
|
6
|
-
Author-Email: =?utf-8?q?Timoth=C3=A9e_Mazzucotelli?= <dev@pawamoy.fr>
|
|
7
|
-
License-Expression: ISC
|
|
8
|
-
License-File: LICENSE
|
|
9
|
-
Classifier: Development Status :: 4 - Beta
|
|
10
|
-
Classifier: Intended Audience :: Developers
|
|
11
|
-
Classifier: Programming Language :: Python
|
|
12
|
-
Classifier: Programming Language :: Python :: 3
|
|
13
|
-
Classifier: Programming Language :: Python :: 3 :: Only
|
|
14
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
-
Classifier: Programming Language :: Python :: 3.13
|
|
18
|
-
Classifier: Programming Language :: Python :: 3.14
|
|
19
|
-
Classifier: Topic :: Documentation
|
|
20
|
-
Classifier: Topic :: Software Development
|
|
21
|
-
Classifier: Topic :: Utilities
|
|
22
|
-
Classifier: Typing :: Typed
|
|
23
|
-
Project-URL: Homepage, https://pawamoy.github.io/markdown-exec
|
|
24
|
-
Project-URL: Documentation, https://pawamoy.github.io/markdown-exec
|
|
25
|
-
Project-URL: Changelog, https://pawamoy.github.io/markdown-exec/changelog
|
|
26
|
-
Project-URL: Repository, https://github.com/pawamoy/markdown-exec
|
|
27
|
-
Project-URL: Issues, https://github.com/pawamoy/markdown-exec/issues
|
|
28
|
-
Project-URL: Discussions, https://github.com/pawamoy/markdown-exec/discussions
|
|
29
|
-
Project-URL: Gitter, https://gitter.im/markdown-exec/community
|
|
30
|
-
Project-URL: Funding, https://github.com/sponsors/pawamoy
|
|
31
|
-
Requires-Python: >=3.10
|
|
32
|
-
Requires-Dist: pymdown-extensions>=9
|
|
33
|
-
Provides-Extra: ansi
|
|
34
|
-
Requires-Dist: pygments-ansi-color>=0.3; extra == "ansi"
|
|
35
|
-
Description-Content-Type: text/markdown
|
|
36
|
-
|
|
37
|
-
# Markdown Exec
|
|
38
|
-
|
|
39
|
-
[](https://github.com/pawamoy/markdown-exec/actions?query=workflow%3Aci)
|
|
40
|
-
[](https://pawamoy.github.io/markdown-exec/)
|
|
41
|
-
[](https://pypi.org/project/markdown-exec/)
|
|
42
|
-
[](https://app.gitter.im/#/room/#markdown-exec:gitter.im)
|
|
43
|
-
[](https://app.radicle.at/nodes/seed.radicle.at/rad:z77aiLJkzYXtuNpZuvizfGkDuZbQ)
|
|
44
|
-
|
|
45
|
-
Utilities to execute code blocks in Markdown files.
|
|
46
|
-
|
|
47
|
-
For example, you write a Python code block that computes some HTML,
|
|
48
|
-
and this HTML is injected in place of the code block.
|
|
49
|
-
|
|
50
|
-
## Installation
|
|
51
|
-
|
|
52
|
-
```bash
|
|
53
|
-
pip install "markdown-exec[ansi]"
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
The `ansi` extra provides the necessary bits (`pygments-ansi-color` and a CSS file)
|
|
57
|
-
to render ANSI colors in HTML code blocks. The CSS file is automatically added
|
|
58
|
-
to MkDocs' `extra_css` when Markdown Exec is activated via `plugins` (see below).
|
|
59
|
-
|
|
60
|
-
## Configuration
|
|
61
|
-
|
|
62
|
-
This extension relies on the
|
|
63
|
-
[SuperFences](https://facelessuser.github.io/pymdown-extensions/extensions/superfences/)
|
|
64
|
-
extension of
|
|
65
|
-
[PyMdown Extensions](https://facelessuser.github.io/pymdown-extensions/).
|
|
66
|
-
|
|
67
|
-
To allow execution of code blocks,
|
|
68
|
-
configure a custom fence from Python:
|
|
69
|
-
|
|
70
|
-
```python
|
|
71
|
-
from markdown import Markdown
|
|
72
|
-
from markdown_exec import formatter, validator
|
|
73
|
-
|
|
74
|
-
Markdown(
|
|
75
|
-
extensions=["pymdownx.superfences"],
|
|
76
|
-
extension_configs={
|
|
77
|
-
"pymdownx.superfences": {
|
|
78
|
-
"custom_fences": [
|
|
79
|
-
{
|
|
80
|
-
"name": "python",
|
|
81
|
-
"class": "python",
|
|
82
|
-
"validator": validator,
|
|
83
|
-
"format": formatter,
|
|
84
|
-
}
|
|
85
|
-
# ...one fence for each language we support:
|
|
86
|
-
# bash, console, md, markdown, py, python, pycon, pyodide, sh, tree, etc.
|
|
87
|
-
]
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
)
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
...or in MkDocs configuration file, as a Markdown extension:
|
|
94
|
-
|
|
95
|
-
```yaml
|
|
96
|
-
# mkdocs.yml
|
|
97
|
-
markdown_extensions:
|
|
98
|
-
- pymdownx.superfences:
|
|
99
|
-
custom_fences:
|
|
100
|
-
- name: python
|
|
101
|
-
class: python
|
|
102
|
-
validator: !!python/name:markdown_exec.validator
|
|
103
|
-
format: !!python/name:markdown_exec.formatter
|
|
104
|
-
# ...one fence for each language we support:
|
|
105
|
-
# bash, console, md, markdown, py, python, pycon, sh, tree
|
|
106
|
-
```
|
|
107
|
-
|
|
108
|
-
...or in MkDocs configuration file, as a plugin:
|
|
109
|
-
|
|
110
|
-
```yaml
|
|
111
|
-
# mkdocs.yml
|
|
112
|
-
plugins:
|
|
113
|
-
- search
|
|
114
|
-
- markdown-exec
|
|
115
|
-
|
|
116
|
-
# SuperFences must still be enabled!
|
|
117
|
-
markdown_extensions:
|
|
118
|
-
- pymdownx.superfences
|
|
119
|
-
```
|
|
120
|
-
|
|
121
|
-
TIP: We recommend enabling Markdown Exec with the MkDocs plugin
|
|
122
|
-
if you are using MkDocs: it will take care of adding relevant
|
|
123
|
-
assets (CSS/JS) to the final site when needed.
|
|
124
|
-
|
|
125
|
-
WARNING: **Limitation of configuration through Markdown/PyMDown.**
|
|
126
|
-
Configuration through `pymdownx.superfences` directly is not well supported for fences that require assets inclusion, like `pyodide`.
|
|
127
|
-
For these you will have to include the assets manually. In the future we will provide ways to include them automatically.
|
|
128
|
-
|
|
129
|
-
## Usage
|
|
130
|
-
|
|
131
|
-
You are now able to execute code blocks instead of displaying them:
|
|
132
|
-
|
|
133
|
-
````md
|
|
134
|
-
```python exec="on"
|
|
135
|
-
print("Hello Markdown!")
|
|
136
|
-
```
|
|
137
|
-
````
|
|
138
|
-
|
|
139
|
-
The `exec` option will be true for every possible value except `0`, `no`, `off` and `false` (case insensitive).
|
|
140
|
-
|
|
141
|
-
Below you can see an example of running a bash script that is expected to
|
|
142
|
-
return a non-zero exit code:
|
|
143
|
-
|
|
144
|
-
````md
|
|
145
|
-
```bash exec="1" source="tabbed-left" returncode="2"
|
|
146
|
-
grep extra_css README.md && exit 2
|
|
147
|
-
```
|
|
148
|
-
````
|
|
149
|
-
|
|
150
|
-
See [usage](https://pawamoy.github.io/markdown-exec/usage/) for more details,
|
|
151
|
-
and the [gallery](https://pawamoy.github.io/markdown-exec/gallery/) for more examples!
|
|
152
|
-
|
|
153
|
-
## Sponsors
|
|
154
|
-
|
|
155
|
-
<!-- sponsors-start -->
|
|
156
|
-
<!-- sponsors-end -->
|
markdown_exec-1.12.0/README.md
DELETED
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
# Markdown Exec
|
|
2
|
-
|
|
3
|
-
[](https://github.com/pawamoy/markdown-exec/actions?query=workflow%3Aci)
|
|
4
|
-
[](https://pawamoy.github.io/markdown-exec/)
|
|
5
|
-
[](https://pypi.org/project/markdown-exec/)
|
|
6
|
-
[](https://app.gitter.im/#/room/#markdown-exec:gitter.im)
|
|
7
|
-
[](https://app.radicle.at/nodes/seed.radicle.at/rad:z77aiLJkzYXtuNpZuvizfGkDuZbQ)
|
|
8
|
-
|
|
9
|
-
Utilities to execute code blocks in Markdown files.
|
|
10
|
-
|
|
11
|
-
For example, you write a Python code block that computes some HTML,
|
|
12
|
-
and this HTML is injected in place of the code block.
|
|
13
|
-
|
|
14
|
-
## Installation
|
|
15
|
-
|
|
16
|
-
```bash
|
|
17
|
-
pip install "markdown-exec[ansi]"
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
The `ansi` extra provides the necessary bits (`pygments-ansi-color` and a CSS file)
|
|
21
|
-
to render ANSI colors in HTML code blocks. The CSS file is automatically added
|
|
22
|
-
to MkDocs' `extra_css` when Markdown Exec is activated via `plugins` (see below).
|
|
23
|
-
|
|
24
|
-
## Configuration
|
|
25
|
-
|
|
26
|
-
This extension relies on the
|
|
27
|
-
[SuperFences](https://facelessuser.github.io/pymdown-extensions/extensions/superfences/)
|
|
28
|
-
extension of
|
|
29
|
-
[PyMdown Extensions](https://facelessuser.github.io/pymdown-extensions/).
|
|
30
|
-
|
|
31
|
-
To allow execution of code blocks,
|
|
32
|
-
configure a custom fence from Python:
|
|
33
|
-
|
|
34
|
-
```python
|
|
35
|
-
from markdown import Markdown
|
|
36
|
-
from markdown_exec import formatter, validator
|
|
37
|
-
|
|
38
|
-
Markdown(
|
|
39
|
-
extensions=["pymdownx.superfences"],
|
|
40
|
-
extension_configs={
|
|
41
|
-
"pymdownx.superfences": {
|
|
42
|
-
"custom_fences": [
|
|
43
|
-
{
|
|
44
|
-
"name": "python",
|
|
45
|
-
"class": "python",
|
|
46
|
-
"validator": validator,
|
|
47
|
-
"format": formatter,
|
|
48
|
-
}
|
|
49
|
-
# ...one fence for each language we support:
|
|
50
|
-
# bash, console, md, markdown, py, python, pycon, pyodide, sh, tree, etc.
|
|
51
|
-
]
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
)
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
...or in MkDocs configuration file, as a Markdown extension:
|
|
58
|
-
|
|
59
|
-
```yaml
|
|
60
|
-
# mkdocs.yml
|
|
61
|
-
markdown_extensions:
|
|
62
|
-
- pymdownx.superfences:
|
|
63
|
-
custom_fences:
|
|
64
|
-
- name: python
|
|
65
|
-
class: python
|
|
66
|
-
validator: !!python/name:markdown_exec.validator
|
|
67
|
-
format: !!python/name:markdown_exec.formatter
|
|
68
|
-
# ...one fence for each language we support:
|
|
69
|
-
# bash, console, md, markdown, py, python, pycon, sh, tree
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
...or in MkDocs configuration file, as a plugin:
|
|
73
|
-
|
|
74
|
-
```yaml
|
|
75
|
-
# mkdocs.yml
|
|
76
|
-
plugins:
|
|
77
|
-
- search
|
|
78
|
-
- markdown-exec
|
|
79
|
-
|
|
80
|
-
# SuperFences must still be enabled!
|
|
81
|
-
markdown_extensions:
|
|
82
|
-
- pymdownx.superfences
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
TIP: We recommend enabling Markdown Exec with the MkDocs plugin
|
|
86
|
-
if you are using MkDocs: it will take care of adding relevant
|
|
87
|
-
assets (CSS/JS) to the final site when needed.
|
|
88
|
-
|
|
89
|
-
WARNING: **Limitation of configuration through Markdown/PyMDown.**
|
|
90
|
-
Configuration through `pymdownx.superfences` directly is not well supported for fences that require assets inclusion, like `pyodide`.
|
|
91
|
-
For these you will have to include the assets manually. In the future we will provide ways to include them automatically.
|
|
92
|
-
|
|
93
|
-
## Usage
|
|
94
|
-
|
|
95
|
-
You are now able to execute code blocks instead of displaying them:
|
|
96
|
-
|
|
97
|
-
````md
|
|
98
|
-
```python exec="on"
|
|
99
|
-
print("Hello Markdown!")
|
|
100
|
-
```
|
|
101
|
-
````
|
|
102
|
-
|
|
103
|
-
The `exec` option will be true for every possible value except `0`, `no`, `off` and `false` (case insensitive).
|
|
104
|
-
|
|
105
|
-
Below you can see an example of running a bash script that is expected to
|
|
106
|
-
return a non-zero exit code:
|
|
107
|
-
|
|
108
|
-
````md
|
|
109
|
-
```bash exec="1" source="tabbed-left" returncode="2"
|
|
110
|
-
grep extra_css README.md && exit 2
|
|
111
|
-
```
|
|
112
|
-
````
|
|
113
|
-
|
|
114
|
-
See [usage](https://pawamoy.github.io/markdown-exec/usage/) for more details,
|
|
115
|
-
and the [gallery](https://pawamoy.github.io/markdown-exec/gallery/) for more examples!
|
|
116
|
-
|
|
117
|
-
## Sponsors
|
|
118
|
-
|
|
119
|
-
<!-- sponsors-start -->
|
|
120
|
-
<!-- sponsors-end -->
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{markdown_exec-1.12.0 → markdown_exec-1.12.1}/src/markdown_exec/_internal/formatters/__init__.py
RENAMED
|
File without changes
|
{markdown_exec-1.12.0 → markdown_exec-1.12.1}/src/markdown_exec/_internal/formatters/_exec_python.py
RENAMED
|
File without changes
|
{markdown_exec-1.12.0 → markdown_exec-1.12.1}/src/markdown_exec/_internal/formatters/base.py
RENAMED
|
File without changes
|
{markdown_exec-1.12.0 → markdown_exec-1.12.1}/src/markdown_exec/_internal/formatters/bash.py
RENAMED
|
File without changes
|
{markdown_exec-1.12.0 → markdown_exec-1.12.1}/src/markdown_exec/_internal/formatters/console.py
RENAMED
|
File without changes
|
{markdown_exec-1.12.0 → markdown_exec-1.12.1}/src/markdown_exec/_internal/formatters/markdown.py
RENAMED
|
File without changes
|
{markdown_exec-1.12.0 → markdown_exec-1.12.1}/src/markdown_exec/_internal/formatters/pycon.py
RENAMED
|
File without changes
|
{markdown_exec-1.12.0 → markdown_exec-1.12.1}/src/markdown_exec/_internal/formatters/pyodide.py
RENAMED
|
File without changes
|
{markdown_exec-1.12.0 → markdown_exec-1.12.1}/src/markdown_exec/_internal/formatters/python.py
RENAMED
|
File without changes
|
|
File without changes
|
{markdown_exec-1.12.0 → markdown_exec-1.12.1}/src/markdown_exec/_internal/formatters/tree.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|