markdown-exec 1.12.0__tar.gz → 1.12.2__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.
Files changed (115) hide show
  1. {markdown_exec-1.12.0 → markdown_exec-1.12.2}/CHANGELOG.md +16 -0
  2. markdown_exec-1.12.2/PKG-INFO +208 -0
  3. markdown_exec-1.12.2/README.md +172 -0
  4. {markdown_exec-1.12.0 → markdown_exec-1.12.2}/pyproject.toml +1 -1
  5. {markdown_exec-1.12.0 → markdown_exec-1.12.2}/scripts/gen_credits.py +1 -1
  6. {markdown_exec-1.12.0 → markdown_exec-1.12.2}/src/markdown_exec/_internal/formatters/pyodide.py +16 -10
  7. {markdown_exec-1.12.0 → markdown_exec-1.12.2}/src/markdown_exec/_internal/rendering.py +5 -0
  8. markdown_exec-1.12.0/PKG-INFO +0 -156
  9. markdown_exec-1.12.0/README.md +0 -120
  10. {markdown_exec-1.12.0 → markdown_exec-1.12.2}/CODE_OF_CONDUCT.md +0 -0
  11. {markdown_exec-1.12.0 → markdown_exec-1.12.2}/CONTRIBUTING.md +0 -0
  12. {markdown_exec-1.12.0 → markdown_exec-1.12.2}/LICENSE +0 -0
  13. {markdown_exec-1.12.0 → markdown_exec-1.12.2}/config/coverage.ini +0 -0
  14. {markdown_exec-1.12.0 → markdown_exec-1.12.2}/config/git-changelog.toml +0 -0
  15. {markdown_exec-1.12.0 → markdown_exec-1.12.2}/config/mypy.ini +0 -0
  16. {markdown_exec-1.12.0 → markdown_exec-1.12.2}/config/pytest.ini +0 -0
  17. {markdown_exec-1.12.0 → markdown_exec-1.12.2}/config/ruff.toml +0 -0
  18. {markdown_exec-1.12.0 → markdown_exec-1.12.2}/config/vscode/launch.json +0 -0
  19. {markdown_exec-1.12.0 → markdown_exec-1.12.2}/config/vscode/settings.json +0 -0
  20. {markdown_exec-1.12.0 → markdown_exec-1.12.2}/config/vscode/tasks.json +0 -0
  21. {markdown_exec-1.12.0 → markdown_exec-1.12.2}/docs/.overrides/main.html +0 -0
  22. {markdown_exec-1.12.0 → markdown_exec-1.12.2}/docs/.overrides/partials/comments.html +0 -0
  23. {markdown_exec-1.12.0 → markdown_exec-1.12.2}/docs/.overrides/partials/path-item.html +0 -0
  24. {markdown_exec-1.12.0 → markdown_exec-1.12.2}/docs/changelog.md +0 -0
  25. {markdown_exec-1.12.0 → markdown_exec-1.12.2}/docs/code_of_conduct.md +0 -0
  26. {markdown_exec-1.12.0 → markdown_exec-1.12.2}/docs/contributing.md +0 -0
  27. {markdown_exec-1.12.0 → markdown_exec-1.12.2}/docs/credits.md +0 -0
  28. {markdown_exec-1.12.0 → markdown_exec-1.12.2}/docs/css/material.css +0 -0
  29. {markdown_exec-1.12.0 → markdown_exec-1.12.2}/docs/css/mkdocstrings.css +0 -0
  30. {markdown_exec-1.12.0 → markdown_exec-1.12.2}/docs/gallery.md +0 -0
  31. {markdown_exec-1.12.0 → markdown_exec-1.12.2}/docs/index.md +0 -0
  32. {markdown_exec-1.12.0 → markdown_exec-1.12.2}/docs/js/feedback.js +0 -0
  33. {markdown_exec-1.12.0 → markdown_exec-1.12.2}/docs/license.md +0 -0
  34. {markdown_exec-1.12.0 → markdown_exec-1.12.2}/docs/reference/api.md +0 -0
  35. {markdown_exec-1.12.0 → markdown_exec-1.12.2}/docs/schema.json +0 -0
  36. {markdown_exec-1.12.0 → markdown_exec-1.12.2}/docs/snippets/gallery/ansi.sh +0 -0
  37. {markdown_exec-1.12.0 → markdown_exec-1.12.2}/docs/snippets/gallery/argparse.py +0 -0
  38. {markdown_exec-1.12.0 → markdown_exec-1.12.2}/docs/snippets/gallery/argparse_format.py +0 -0
  39. {markdown_exec-1.12.0 → markdown_exec-1.12.2}/docs/snippets/gallery/chalk.py +0 -0
  40. {markdown_exec-1.12.0 → markdown_exec-1.12.2}/docs/snippets/gallery/d2.py +0 -0
  41. {markdown_exec-1.12.0 → markdown_exec-1.12.2}/docs/snippets/gallery/diagrams.py +0 -0
  42. {markdown_exec-1.12.0 → markdown_exec-1.12.2}/docs/snippets/gallery/drawsvg.py +0 -0
  43. {markdown_exec-1.12.0 → markdown_exec-1.12.2}/docs/snippets/gallery/expandable_filetree.py +0 -0
  44. {markdown_exec-1.12.0 → markdown_exec-1.12.2}/docs/snippets/gallery/hyperbolic.py +0 -0
  45. {markdown_exec-1.12.0 → markdown_exec-1.12.2}/docs/snippets/gallery/matplotlib.py +0 -0
  46. {markdown_exec-1.12.0 → markdown_exec-1.12.2}/docs/snippets/gallery/plotly.py +0 -0
  47. {markdown_exec-1.12.0 → markdown_exec-1.12.2}/docs/snippets/gallery/pydeps.py +0 -0
  48. {markdown_exec-1.12.0 → markdown_exec-1.12.2}/docs/snippets/gallery/qrcode.py +0 -0
  49. {markdown_exec-1.12.0 → markdown_exec-1.12.2}/docs/snippets/gallery/rich.py +0 -0
  50. {markdown_exec-1.12.0 → markdown_exec-1.12.2}/docs/snippets/gallery/rich_terminal.py +0 -0
  51. {markdown_exec-1.12.0 → markdown_exec-1.12.2}/docs/snippets/gallery/runpy.py +0 -0
  52. {markdown_exec-1.12.0 → markdown_exec-1.12.2}/docs/snippets/gallery/textual.py +0 -0
  53. {markdown_exec-1.12.0 → markdown_exec-1.12.2}/docs/snippets/usage/boolean_matrix.py +0 -0
  54. {markdown_exec-1.12.0 → markdown_exec-1.12.2}/docs/snippets/usage/hide.py +0 -0
  55. {markdown_exec-1.12.0 → markdown_exec-1.12.2}/docs/snippets/usage/multiple.pycon +0 -0
  56. {markdown_exec-1.12.0 → markdown_exec-1.12.2}/docs/snippets/usage/platform_html.py +0 -0
  57. {markdown_exec-1.12.0 → markdown_exec-1.12.2}/docs/snippets/usage/platform_md.py +0 -0
  58. {markdown_exec-1.12.0 → markdown_exec-1.12.2}/docs/snippets/usage/source.py +0 -0
  59. {markdown_exec-1.12.0 → markdown_exec-1.12.2}/docs/snippets/usage/source.pycon +0 -0
  60. {markdown_exec-1.12.0 → markdown_exec-1.12.2}/docs/usage/index.md +0 -0
  61. {markdown_exec-1.12.0 → markdown_exec-1.12.2}/docs/usage/pyodide.md +0 -0
  62. {markdown_exec-1.12.0 → markdown_exec-1.12.2}/docs/usage/python.md +0 -0
  63. {markdown_exec-1.12.0 → markdown_exec-1.12.2}/docs/usage/shell.md +0 -0
  64. {markdown_exec-1.12.0 → markdown_exec-1.12.2}/docs/usage/tree.md +0 -0
  65. {markdown_exec-1.12.0 → markdown_exec-1.12.2}/duties.py +0 -0
  66. {markdown_exec-1.12.0 → markdown_exec-1.12.2}/mkdocs.yml +0 -0
  67. {markdown_exec-1.12.0 → markdown_exec-1.12.2}/scripts/get_version.py +0 -0
  68. {markdown_exec-1.12.0 → markdown_exec-1.12.2}/scripts/make +0 -0
  69. {markdown_exec-1.12.0 → markdown_exec-1.12.2}/scripts/make.py +0 -0
  70. {markdown_exec-1.12.0 → markdown_exec-1.12.2}/src/markdown_exec/__init__.py +0 -0
  71. {markdown_exec-1.12.0 → markdown_exec-1.12.2}/src/markdown_exec/_internal/__init__.py +0 -0
  72. {markdown_exec-1.12.0 → markdown_exec-1.12.2}/src/markdown_exec/_internal/debug.py +0 -0
  73. {markdown_exec-1.12.0 → markdown_exec-1.12.2}/src/markdown_exec/_internal/formatters/__init__.py +0 -0
  74. {markdown_exec-1.12.0 → markdown_exec-1.12.2}/src/markdown_exec/_internal/formatters/_exec_python.py +0 -0
  75. {markdown_exec-1.12.0 → markdown_exec-1.12.2}/src/markdown_exec/_internal/formatters/base.py +0 -0
  76. {markdown_exec-1.12.0 → markdown_exec-1.12.2}/src/markdown_exec/_internal/formatters/bash.py +0 -0
  77. {markdown_exec-1.12.0 → markdown_exec-1.12.2}/src/markdown_exec/_internal/formatters/console.py +0 -0
  78. {markdown_exec-1.12.0 → markdown_exec-1.12.2}/src/markdown_exec/_internal/formatters/markdown.py +0 -0
  79. {markdown_exec-1.12.0 → markdown_exec-1.12.2}/src/markdown_exec/_internal/formatters/pycon.py +0 -0
  80. {markdown_exec-1.12.0 → markdown_exec-1.12.2}/src/markdown_exec/_internal/formatters/python.py +0 -0
  81. {markdown_exec-1.12.0 → markdown_exec-1.12.2}/src/markdown_exec/_internal/formatters/sh.py +0 -0
  82. {markdown_exec-1.12.0 → markdown_exec-1.12.2}/src/markdown_exec/_internal/formatters/tree.py +0 -0
  83. {markdown_exec-1.12.0 → markdown_exec-1.12.2}/src/markdown_exec/_internal/logger.py +0 -0
  84. {markdown_exec-1.12.0 → markdown_exec-1.12.2}/src/markdown_exec/_internal/main.py +0 -0
  85. {markdown_exec-1.12.0 → markdown_exec-1.12.2}/src/markdown_exec/_internal/mkdocs_plugin.py +0 -0
  86. {markdown_exec-1.12.0 → markdown_exec-1.12.2}/src/markdown_exec/_internal/processors.py +0 -0
  87. {markdown_exec-1.12.0 → markdown_exec-1.12.2}/src/markdown_exec/assets/ansi.css +0 -0
  88. {markdown_exec-1.12.0 → markdown_exec-1.12.2}/src/markdown_exec/assets/pyodide.css +0 -0
  89. {markdown_exec-1.12.0 → markdown_exec-1.12.2}/src/markdown_exec/assets/pyodide.js +0 -0
  90. {markdown_exec-1.12.0 → markdown_exec-1.12.2}/src/markdown_exec/formatters/__init__.py +0 -0
  91. {markdown_exec-1.12.0 → markdown_exec-1.12.2}/src/markdown_exec/formatters/base.py +0 -0
  92. {markdown_exec-1.12.0 → markdown_exec-1.12.2}/src/markdown_exec/formatters/bash.py +0 -0
  93. {markdown_exec-1.12.0 → markdown_exec-1.12.2}/src/markdown_exec/formatters/console.py +0 -0
  94. {markdown_exec-1.12.0 → markdown_exec-1.12.2}/src/markdown_exec/formatters/markdown.py +0 -0
  95. {markdown_exec-1.12.0 → markdown_exec-1.12.2}/src/markdown_exec/formatters/pycon.py +0 -0
  96. {markdown_exec-1.12.0 → markdown_exec-1.12.2}/src/markdown_exec/formatters/pyodide.py +0 -0
  97. {markdown_exec-1.12.0 → markdown_exec-1.12.2}/src/markdown_exec/formatters/python.py +0 -0
  98. {markdown_exec-1.12.0 → markdown_exec-1.12.2}/src/markdown_exec/formatters/sh.py +0 -0
  99. {markdown_exec-1.12.0 → markdown_exec-1.12.2}/src/markdown_exec/formatters/tree.py +0 -0
  100. {markdown_exec-1.12.0 → markdown_exec-1.12.2}/src/markdown_exec/logger.py +0 -0
  101. {markdown_exec-1.12.0 → markdown_exec-1.12.2}/src/markdown_exec/mkdocs_plugin.py +0 -0
  102. {markdown_exec-1.12.0 → markdown_exec-1.12.2}/src/markdown_exec/processors.py +0 -0
  103. {markdown_exec-1.12.0 → markdown_exec-1.12.2}/src/markdown_exec/py.typed +0 -0
  104. {markdown_exec-1.12.0 → markdown_exec-1.12.2}/src/markdown_exec/rendering.py +0 -0
  105. {markdown_exec-1.12.0 → markdown_exec-1.12.2}/tests/__init__.py +0 -0
  106. {markdown_exec-1.12.0 → markdown_exec-1.12.2}/tests/conftest.py +0 -0
  107. {markdown_exec-1.12.0 → markdown_exec-1.12.2}/tests/test_api.py +0 -0
  108. {markdown_exec-1.12.0 → markdown_exec-1.12.2}/tests/test_base_formatter.py +0 -0
  109. {markdown_exec-1.12.0 → markdown_exec-1.12.2}/tests/test_converter.py +0 -0
  110. {markdown_exec-1.12.0 → markdown_exec-1.12.2}/tests/test_headings.py +0 -0
  111. {markdown_exec-1.12.0 → markdown_exec-1.12.2}/tests/test_python.py +0 -0
  112. {markdown_exec-1.12.0 → markdown_exec-1.12.2}/tests/test_shell.py +0 -0
  113. {markdown_exec-1.12.0 → markdown_exec-1.12.2}/tests/test_toc.py +0 -0
  114. {markdown_exec-1.12.0 → markdown_exec-1.12.2}/tests/test_tree.py +0 -0
  115. {markdown_exec-1.12.0 → markdown_exec-1.12.2}/tests/test_validator.py +0 -0
@@ -5,6 +5,22 @@ 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.2](https://github.com/pawamoy/markdown-exec/releases/tag/1.12.2) - 2026-07-05
9
+
10
+ <small>[Compare with 1.12.1](https://github.com/pawamoy/markdown-exec/compare/1.12.1...1.12.2)</small>
11
+
12
+ ### Code Refactoring
13
+
14
+ - Better integrate with Zensical ([e4f60c1](https://github.com/pawamoy/markdown-exec/commit/e4f60c12de3b05fb31486b5823f45258d281d001) by Timothée Mazzucotelli). [PR-99](https://github.com/pawamoy/markdown-exec/pull/99)
15
+
16
+ ## [1.12.1](https://github.com/pawamoy/markdown-exec/releases/tag/1.12.1) - 2025-11-11
17
+
18
+ <small>[Compare with 1.12.0](https://github.com/pawamoy/markdown-exec/compare/1.12.0...1.12.1)</small>
19
+
20
+ ### Code Refactoring
21
+
22
+ - Always register tables extension, needed for Zensical ([1f95bf0](https://github.com/pawamoy/markdown-exec/commit/1f95bf0a8b4a056a14f737b9bada0acc11de5e02) by Timothée Mazzucotelli).
23
+
8
24
  ## [1.12.0](https://github.com/pawamoy/markdown-exec/releases/tag/1.12.0) - 2025-11-10
9
25
 
10
26
  <small>[Compare with 1.11.0](https://github.com/pawamoy/markdown-exec/compare/1.11.0...1.12.0)</small>
@@ -0,0 +1,208 @@
1
+ Metadata-Version: 2.4
2
+ Name: markdown-exec
3
+ Version: 1.12.2
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
+ [![ci](https://github.com/pawamoy/markdown-exec/workflows/ci/badge.svg)](https://github.com/pawamoy/markdown-exec/actions?query=workflow%3Aci)
40
+ [![documentation](https://img.shields.io/badge/docs-mkdocs-708FCC.svg?style=flat)](https://pawamoy.github.io/markdown-exec/)
41
+ [![pypi version](https://img.shields.io/pypi/v/markdown-exec.svg)](https://pypi.org/project/markdown-exec/)
42
+ [![gitter](https://img.shields.io/badge/matrix-chat-4DB798.svg?style=flat)](https://app.gitter.im/#/room/#markdown-exec:gitter.im)
43
+ [![radicle](https://img.shields.io/badge/rad-clone-6666FF.svg?style=flat)](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://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>
161
+ </p></div>
162
+
163
+ <div id="bronze-sponsors"><b>Bronze sponsors</b><p>
164
+ <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>
165
+ </p></div>
166
+ </div>
167
+
168
+ ---
169
+
170
+ <div id="sponsors"><p>
171
+ <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>
172
+ <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>
173
+ <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>
174
+ <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>
175
+ <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>
176
+ <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>
177
+ <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>
178
+ <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>
179
+ <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>
180
+ <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>
181
+ <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>
182
+ <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>
183
+ <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>
184
+ <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>
185
+ <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>
186
+ <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>
187
+ <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>
188
+ <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>
189
+ <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>
190
+ <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>
191
+ <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>
192
+ <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>
193
+ <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>
194
+ <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>
195
+ <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>
196
+ <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>
197
+ <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>
198
+ <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>
199
+ <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>
200
+ <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>
201
+ <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>
202
+ <a href="https://github.com/Cusp-AI"><img alt="Cusp-AI" src="https://avatars.githubusercontent.com/u/178170649?v=4" style="height: 32px; border-radius: 100%;"></a>
203
+ </p></div>
204
+
205
+
206
+ *And 7 more private sponsor(s).*
207
+
208
+ <!-- sponsors-end -->
@@ -0,0 +1,172 @@
1
+ # Markdown Exec
2
+
3
+ [![ci](https://github.com/pawamoy/markdown-exec/workflows/ci/badge.svg)](https://github.com/pawamoy/markdown-exec/actions?query=workflow%3Aci)
4
+ [![documentation](https://img.shields.io/badge/docs-mkdocs-708FCC.svg?style=flat)](https://pawamoy.github.io/markdown-exec/)
5
+ [![pypi version](https://img.shields.io/pypi/v/markdown-exec.svg)](https://pypi.org/project/markdown-exec/)
6
+ [![gitter](https://img.shields.io/badge/matrix-chat-4DB798.svg?style=flat)](https://app.gitter.im/#/room/#markdown-exec:gitter.im)
7
+ [![radicle](https://img.shields.io/badge/rad-clone-6666FF.svg?style=flat)](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://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>
125
+ </p></div>
126
+
127
+ <div id="bronze-sponsors"><b>Bronze sponsors</b><p>
128
+ <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>
129
+ </p></div>
130
+ </div>
131
+
132
+ ---
133
+
134
+ <div id="sponsors"><p>
135
+ <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>
136
+ <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>
137
+ <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>
138
+ <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>
139
+ <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>
140
+ <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>
141
+ <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>
142
+ <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>
143
+ <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>
144
+ <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>
145
+ <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>
146
+ <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>
147
+ <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>
148
+ <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>
149
+ <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>
150
+ <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>
151
+ <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>
152
+ <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>
153
+ <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>
154
+ <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>
155
+ <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>
156
+ <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>
157
+ <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>
158
+ <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>
159
+ <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>
160
+ <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>
161
+ <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>
162
+ <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>
163
+ <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>
164
+ <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>
165
+ <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>
166
+ <a href="https://github.com/Cusp-AI"><img alt="Cusp-AI" src="https://avatars.githubusercontent.com/u/178170649?v=4" style="height: 32px; border-radius: 100%;"></a>
167
+ </p></div>
168
+
169
+
170
+ *And 7 more private sponsor(s).*
171
+
172
+ <!-- sponsors-end -->
@@ -44,7 +44,7 @@ classifiers = [
44
44
  dependencies = [
45
45
  "pymdown-extensions>=9",
46
46
  ]
47
- version = "1.12.0"
47
+ version = "1.12.2"
48
48
 
49
49
  [project.optional-dependencies]
50
50
  ansi = [
@@ -55,7 +55,7 @@ def _extra_marker(req: Requirement) -> str | None:
55
55
  if not req.marker:
56
56
  return None
57
57
  try:
58
- return next(marker[2].value for marker in req.marker._markers if getattr(marker[0], "value", None) == "extra")
58
+ return next(marker[2].value for marker in req.marker._markers if getattr(marker[0], "value", None) == "extra") # type: ignore[union-attr]
59
59
  except StopIteration:
60
60
  return None
61
61
 
@@ -4,16 +4,16 @@ from __future__ import annotations
4
4
 
5
5
  from typing import TYPE_CHECKING, Any
6
6
 
7
+ import markdown_exec
8
+
7
9
  if TYPE_CHECKING:
8
10
  from markdown import Markdown
9
11
 
10
12
  # All Ace.js themes listed here:
11
13
  # https://github.com/ajaxorg/ace/tree/master/src/theme
12
14
 
13
- _play_emoji = (
14
- '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M8 5.14v14l11-7-11-7Z"></path></svg>'
15
- )
16
- _clear_emoji = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M15.14 3c-.51 0-1.02.2-1.41.59L2.59 14.73c-.78.77-.78 2.04 0 2.83L5.03 20h7.66l8.72-8.73c.79-.77.79-2.04 0-2.83l-4.85-4.85c-.39-.39-.91-.59-1.42-.59M17 18l-2 2h7v-2"></path></svg>'
15
+ _play_emoji = '<span class="twemoji"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M8 5.14v14l11-7-11-7Z"></path></svg></span> '
16
+ _clear_emoji = '<span class="twemoji"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M15.14 3c-.51 0-1.02.2-1.41.59L2.59 14.73c-.78.77-.78 2.04 0 2.83L5.03 20h7.66l8.72-8.73c.79-.77.79-2.04 0-2.83l-4.85-4.85c-.39-.39-.91-.59-1.42-.59M17 18l-2 2h7v-2"></path></svg></span> '
17
17
 
18
18
  _assets = """
19
19
  <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.16.0/ace.js"></script>
@@ -26,15 +26,17 @@ _assets = """
26
26
  _template = """
27
27
  <div class="pyodide">
28
28
  <div class="pyodide-editor-bar">
29
- <span class="pyodide-bar-item">Editor (session: %(session)s)</span><span id="%(id_prefix)srun" title="Run: press Ctrl-Enter" class="pyodide-bar-item pyodide-clickable"><span class="twemoji">%(play_emoji)s</span> Run</span>
29
+ <span class="pyodide-bar-item">Editor (session: %(session)s)</span><span id="%(id_prefix)srun" title="Run: press Ctrl-Enter" class="pyodide-bar-item pyodide-clickable">%(play_emoji)sRun</span>
30
30
  </div>
31
31
  <div><pre id="%(id_prefix)seditor" class="pyodide-editor">%(initial_code)s</pre></div>
32
32
  <div class="pyodide-editor-bar">
33
- <span class="pyodide-bar-item">Output</span><span id="%(id_prefix)sclear" class="pyodide-bar-item pyodide-clickable"><span class="twemoji">%(clear_emoji)s</span> Clear</span>
33
+ <span class="pyodide-bar-item">Output</span><span id="%(id_prefix)sclear" class="pyodide-bar-item pyodide-clickable">%(clear_emoji)sClear</span>
34
34
  </div>
35
35
  <pre><code id="%(id_prefix)soutput" class="pyodide-output"></code></pre>
36
36
  </div>
37
+ """
37
38
 
39
+ _script = """
38
40
  <script>
39
41
  document.addEventListener('DOMContentLoaded', (event) => {
40
42
  setupPyodide(
@@ -83,6 +85,7 @@ def _format_pyodide(code: str, md: Markdown, session: str, extra: dict, **option
83
85
  theme_light, theme_dark = theme.split(",")
84
86
  min_lines, max_lines = _calculate_height(code, extra)
85
87
 
88
+ zensical = getattr(markdown_exec, "_caller", "") == "zensical"
86
89
  data = {
87
90
  "id_prefix": f"exec-{_counter}--",
88
91
  "initial_code": code,
@@ -90,12 +93,15 @@ def _format_pyodide(code: str, md: Markdown, session: str, extra: dict, **option
90
93
  "theme_light": theme_light.strip(),
91
94
  "theme_dark": theme_dark.strip(),
92
95
  "session": session or "default",
93
- "play_emoji": _play_emoji,
94
- "clear_emoji": _clear_emoji,
96
+ "play_emoji": "" if zensical else _play_emoji,
97
+ "clear_emoji": "" if zensical else _clear_emoji,
95
98
  "min_lines": min_lines,
96
99
  "max_lines": max_lines,
97
100
  }
98
- rendered = _template % data
99
- if exclude_assets:
101
+ rendered = _template
102
+ if not zensical:
103
+ rendered += _script
104
+ rendered %= data
105
+ if zensical or exclude_assets:
100
106
  return rendered
101
107
  return _assets.format(version=version) + rendered
@@ -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, ""),
@@ -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
- [![ci](https://github.com/pawamoy/markdown-exec/workflows/ci/badge.svg)](https://github.com/pawamoy/markdown-exec/actions?query=workflow%3Aci)
40
- [![documentation](https://img.shields.io/badge/docs-mkdocs-708FCC.svg?style=flat)](https://pawamoy.github.io/markdown-exec/)
41
- [![pypi version](https://img.shields.io/pypi/v/markdown-exec.svg)](https://pypi.org/project/markdown-exec/)
42
- [![gitter](https://img.shields.io/badge/matrix-chat-4DB798.svg?style=flat)](https://app.gitter.im/#/room/#markdown-exec:gitter.im)
43
- [![radicle](https://img.shields.io/badge/rad-clone-6666FF.svg?style=flat)](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 -->
@@ -1,120 +0,0 @@
1
- # Markdown Exec
2
-
3
- [![ci](https://github.com/pawamoy/markdown-exec/workflows/ci/badge.svg)](https://github.com/pawamoy/markdown-exec/actions?query=workflow%3Aci)
4
- [![documentation](https://img.shields.io/badge/docs-mkdocs-708FCC.svg?style=flat)](https://pawamoy.github.io/markdown-exec/)
5
- [![pypi version](https://img.shields.io/pypi/v/markdown-exec.svg)](https://pypi.org/project/markdown-exec/)
6
- [![gitter](https://img.shields.io/badge/matrix-chat-4DB798.svg?style=flat)](https://app.gitter.im/#/room/#markdown-exec:gitter.im)
7
- [![radicle](https://img.shields.io/badge/rad-clone-6666FF.svg?style=flat)](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