markdown-exec 1.12.5__tar.gz → 1.13.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (120) hide show
  1. {markdown_exec-1.12.5 → markdown_exec-1.13.0}/CHANGELOG.md +16 -0
  2. {markdown_exec-1.12.5 → markdown_exec-1.13.0}/PKG-INFO +2 -6
  3. {markdown_exec-1.12.5 → markdown_exec-1.13.0}/README.md +1 -5
  4. {markdown_exec-1.12.5 → markdown_exec-1.13.0}/config/ruff.toml +1 -0
  5. {markdown_exec-1.12.5 → markdown_exec-1.13.0}/docs/gallery.md +24 -0
  6. markdown_exec-1.13.0/docs/snippets/gallery/highcharts.py +17 -0
  7. markdown_exec-1.13.0/docs/snippets/gallery/vega.py +59 -0
  8. markdown_exec-1.13.0/docs/snippets/usage/interactive.pycon +5 -0
  9. markdown_exec-1.13.0/docs/usage/python.md +73 -0
  10. {markdown_exec-1.12.5 → markdown_exec-1.13.0}/duties.py +1 -1
  11. {markdown_exec-1.12.5 → markdown_exec-1.13.0}/pyproject.toml +2 -2
  12. {markdown_exec-1.12.5 → markdown_exec-1.13.0}/scripts/gen_credits.py +1 -1
  13. {markdown_exec-1.12.5 → markdown_exec-1.13.0}/scripts/get_version.py +1 -1
  14. {markdown_exec-1.12.5 → markdown_exec-1.13.0}/scripts/make.py +2 -2
  15. {markdown_exec-1.12.5 → markdown_exec-1.13.0}/src/markdown_exec/_internal/formatters/_exec_python.py +28 -0
  16. {markdown_exec-1.12.5 → markdown_exec-1.13.0}/src/markdown_exec/_internal/formatters/base.py +12 -4
  17. {markdown_exec-1.12.5 → markdown_exec-1.13.0}/src/markdown_exec/_internal/formatters/pycon.py +10 -2
  18. markdown_exec-1.13.0/src/markdown_exec/_internal/formatters/python.py +242 -0
  19. {markdown_exec-1.12.5 → markdown_exec-1.13.0}/src/markdown_exec/_internal/formatters/tree.py +3 -3
  20. {markdown_exec-1.12.5 → markdown_exec-1.13.0}/src/markdown_exec/_internal/main.py +2 -0
  21. {markdown_exec-1.12.5 → markdown_exec-1.13.0}/src/markdown_exec/_internal/processors.py +1 -1
  22. {markdown_exec-1.12.5 → markdown_exec-1.13.0}/src/markdown_exec/_internal/rendering.py +6 -6
  23. {markdown_exec-1.12.5 → markdown_exec-1.13.0}/tests/test_python.py +118 -0
  24. {markdown_exec-1.12.5 → markdown_exec-1.13.0}/tests/test_toc.py +9 -9
  25. {markdown_exec-1.12.5 → markdown_exec-1.13.0}/tests/test_tree.py +12 -0
  26. markdown_exec-1.12.5/docs/usage/python.md +0 -39
  27. markdown_exec-1.12.5/src/markdown_exec/_internal/formatters/python.py +0 -103
  28. {markdown_exec-1.12.5 → markdown_exec-1.13.0}/AI_POLICY.md +0 -0
  29. {markdown_exec-1.12.5 → markdown_exec-1.13.0}/CODE_OF_CONDUCT.md +0 -0
  30. {markdown_exec-1.12.5 → markdown_exec-1.13.0}/CONTRIBUTING.md +0 -0
  31. {markdown_exec-1.12.5 → markdown_exec-1.13.0}/LICENSE +0 -0
  32. {markdown_exec-1.12.5 → markdown_exec-1.13.0}/config/coverage.ini +0 -0
  33. {markdown_exec-1.12.5 → markdown_exec-1.13.0}/config/git-changelog.toml +0 -0
  34. {markdown_exec-1.12.5 → markdown_exec-1.13.0}/config/pytest.ini +0 -0
  35. {markdown_exec-1.12.5 → markdown_exec-1.13.0}/config/ty.toml +0 -0
  36. {markdown_exec-1.12.5 → markdown_exec-1.13.0}/config/vscode/launch.json +0 -0
  37. {markdown_exec-1.12.5 → markdown_exec-1.13.0}/config/vscode/settings.json +0 -0
  38. {markdown_exec-1.12.5 → markdown_exec-1.13.0}/config/vscode/tasks.json +0 -0
  39. {markdown_exec-1.12.5 → markdown_exec-1.13.0}/config/zed/debug.json +0 -0
  40. {markdown_exec-1.12.5 → markdown_exec-1.13.0}/config/zed/settings.json +0 -0
  41. {markdown_exec-1.12.5 → markdown_exec-1.13.0}/config/zed/tasks.json +0 -0
  42. {markdown_exec-1.12.5 → markdown_exec-1.13.0}/docs/.overrides/main.html +0 -0
  43. {markdown_exec-1.12.5 → markdown_exec-1.13.0}/docs/.overrides/partials/comments.html +0 -0
  44. {markdown_exec-1.12.5 → markdown_exec-1.13.0}/docs/changelog.md +0 -0
  45. {markdown_exec-1.12.5 → markdown_exec-1.13.0}/docs/code_of_conduct.md +0 -0
  46. {markdown_exec-1.12.5 → markdown_exec-1.13.0}/docs/contributing.md +0 -0
  47. {markdown_exec-1.12.5 → markdown_exec-1.13.0}/docs/credits.md +0 -0
  48. {markdown_exec-1.12.5 → markdown_exec-1.13.0}/docs/css/apidocs.css +0 -0
  49. {markdown_exec-1.12.5 → markdown_exec-1.13.0}/docs/index.md +0 -0
  50. {markdown_exec-1.12.5 → markdown_exec-1.13.0}/docs/js/feedback.js +0 -0
  51. {markdown_exec-1.12.5 → markdown_exec-1.13.0}/docs/license.md +0 -0
  52. {markdown_exec-1.12.5 → markdown_exec-1.13.0}/docs/reference/api.md +0 -0
  53. {markdown_exec-1.12.5 → markdown_exec-1.13.0}/docs/schema.json +0 -0
  54. {markdown_exec-1.12.5 → markdown_exec-1.13.0}/docs/snippets/gallery/ansi.sh +0 -0
  55. {markdown_exec-1.12.5 → markdown_exec-1.13.0}/docs/snippets/gallery/argparse.py +0 -0
  56. {markdown_exec-1.12.5 → markdown_exec-1.13.0}/docs/snippets/gallery/argparse_format.py +0 -0
  57. {markdown_exec-1.12.5 → markdown_exec-1.13.0}/docs/snippets/gallery/chalk.py +0 -0
  58. {markdown_exec-1.12.5 → markdown_exec-1.13.0}/docs/snippets/gallery/d2.py +0 -0
  59. {markdown_exec-1.12.5 → markdown_exec-1.13.0}/docs/snippets/gallery/diagrams.py +0 -0
  60. {markdown_exec-1.12.5 → markdown_exec-1.13.0}/docs/snippets/gallery/drawsvg.py +0 -0
  61. {markdown_exec-1.12.5 → markdown_exec-1.13.0}/docs/snippets/gallery/expandable_filetree.py +0 -0
  62. {markdown_exec-1.12.5 → markdown_exec-1.13.0}/docs/snippets/gallery/hyperbolic.py +0 -0
  63. {markdown_exec-1.12.5 → markdown_exec-1.13.0}/docs/snippets/gallery/matplotlib.py +0 -0
  64. {markdown_exec-1.12.5 → markdown_exec-1.13.0}/docs/snippets/gallery/plotly.py +0 -0
  65. {markdown_exec-1.12.5 → markdown_exec-1.13.0}/docs/snippets/gallery/pydeps.py +0 -0
  66. {markdown_exec-1.12.5 → markdown_exec-1.13.0}/docs/snippets/gallery/qrcode.py +0 -0
  67. {markdown_exec-1.12.5 → markdown_exec-1.13.0}/docs/snippets/gallery/rich.py +0 -0
  68. {markdown_exec-1.12.5 → markdown_exec-1.13.0}/docs/snippets/gallery/rich_terminal.py +0 -0
  69. {markdown_exec-1.12.5 → markdown_exec-1.13.0}/docs/snippets/gallery/runpy.py +0 -0
  70. {markdown_exec-1.12.5 → markdown_exec-1.13.0}/docs/snippets/gallery/textual.py +0 -0
  71. {markdown_exec-1.12.5 → markdown_exec-1.13.0}/docs/snippets/usage/boolean_matrix.py +0 -0
  72. {markdown_exec-1.12.5 → markdown_exec-1.13.0}/docs/snippets/usage/hide.py +0 -0
  73. {markdown_exec-1.12.5 → markdown_exec-1.13.0}/docs/snippets/usage/multiple.pycon +0 -0
  74. {markdown_exec-1.12.5 → markdown_exec-1.13.0}/docs/snippets/usage/platform_html.py +0 -0
  75. {markdown_exec-1.12.5 → markdown_exec-1.13.0}/docs/snippets/usage/platform_md.py +0 -0
  76. {markdown_exec-1.12.5 → markdown_exec-1.13.0}/docs/snippets/usage/source.py +0 -0
  77. {markdown_exec-1.12.5 → markdown_exec-1.13.0}/docs/snippets/usage/source.pycon +0 -0
  78. {markdown_exec-1.12.5 → markdown_exec-1.13.0}/docs/usage/index.md +0 -0
  79. {markdown_exec-1.12.5 → markdown_exec-1.13.0}/docs/usage/pyodide.md +0 -0
  80. {markdown_exec-1.12.5 → markdown_exec-1.13.0}/docs/usage/shell.md +0 -0
  81. {markdown_exec-1.12.5 → markdown_exec-1.13.0}/docs/usage/tree.md +0 -0
  82. {markdown_exec-1.12.5 → markdown_exec-1.13.0}/scripts/make +0 -0
  83. {markdown_exec-1.12.5 → markdown_exec-1.13.0}/src/markdown_exec/__init__.py +0 -0
  84. {markdown_exec-1.12.5 → markdown_exec-1.13.0}/src/markdown_exec/_internal/__init__.py +0 -0
  85. {markdown_exec-1.12.5 → markdown_exec-1.13.0}/src/markdown_exec/_internal/debug.py +0 -0
  86. {markdown_exec-1.12.5 → markdown_exec-1.13.0}/src/markdown_exec/_internal/formatters/__init__.py +0 -0
  87. {markdown_exec-1.12.5 → markdown_exec-1.13.0}/src/markdown_exec/_internal/formatters/bash.py +0 -0
  88. {markdown_exec-1.12.5 → markdown_exec-1.13.0}/src/markdown_exec/_internal/formatters/console.py +0 -0
  89. {markdown_exec-1.12.5 → markdown_exec-1.13.0}/src/markdown_exec/_internal/formatters/markdown.py +0 -0
  90. {markdown_exec-1.12.5 → markdown_exec-1.13.0}/src/markdown_exec/_internal/formatters/pyodide.py +0 -0
  91. {markdown_exec-1.12.5 → markdown_exec-1.13.0}/src/markdown_exec/_internal/formatters/sh.py +0 -0
  92. {markdown_exec-1.12.5 → markdown_exec-1.13.0}/src/markdown_exec/_internal/logger.py +0 -0
  93. {markdown_exec-1.12.5 → markdown_exec-1.13.0}/src/markdown_exec/_internal/mkdocs_plugin.py +0 -0
  94. {markdown_exec-1.12.5 → markdown_exec-1.13.0}/src/markdown_exec/assets/ansi.css +0 -0
  95. {markdown_exec-1.12.5 → markdown_exec-1.13.0}/src/markdown_exec/assets/pyodide.css +0 -0
  96. {markdown_exec-1.12.5 → markdown_exec-1.13.0}/src/markdown_exec/assets/pyodide.js +0 -0
  97. {markdown_exec-1.12.5 → markdown_exec-1.13.0}/src/markdown_exec/formatters/__init__.py +0 -0
  98. {markdown_exec-1.12.5 → markdown_exec-1.13.0}/src/markdown_exec/formatters/base.py +0 -0
  99. {markdown_exec-1.12.5 → markdown_exec-1.13.0}/src/markdown_exec/formatters/bash.py +0 -0
  100. {markdown_exec-1.12.5 → markdown_exec-1.13.0}/src/markdown_exec/formatters/console.py +0 -0
  101. {markdown_exec-1.12.5 → markdown_exec-1.13.0}/src/markdown_exec/formatters/markdown.py +0 -0
  102. {markdown_exec-1.12.5 → markdown_exec-1.13.0}/src/markdown_exec/formatters/pycon.py +0 -0
  103. {markdown_exec-1.12.5 → markdown_exec-1.13.0}/src/markdown_exec/formatters/pyodide.py +0 -0
  104. {markdown_exec-1.12.5 → markdown_exec-1.13.0}/src/markdown_exec/formatters/python.py +0 -0
  105. {markdown_exec-1.12.5 → markdown_exec-1.13.0}/src/markdown_exec/formatters/sh.py +0 -0
  106. {markdown_exec-1.12.5 → markdown_exec-1.13.0}/src/markdown_exec/formatters/tree.py +0 -0
  107. {markdown_exec-1.12.5 → markdown_exec-1.13.0}/src/markdown_exec/logger.py +0 -0
  108. {markdown_exec-1.12.5 → markdown_exec-1.13.0}/src/markdown_exec/mkdocs_plugin.py +0 -0
  109. {markdown_exec-1.12.5 → markdown_exec-1.13.0}/src/markdown_exec/processors.py +0 -0
  110. {markdown_exec-1.12.5 → markdown_exec-1.13.0}/src/markdown_exec/py.typed +0 -0
  111. {markdown_exec-1.12.5 → markdown_exec-1.13.0}/src/markdown_exec/rendering.py +0 -0
  112. {markdown_exec-1.12.5 → markdown_exec-1.13.0}/tests/__init__.py +0 -0
  113. {markdown_exec-1.12.5 → markdown_exec-1.13.0}/tests/conftest.py +0 -0
  114. {markdown_exec-1.12.5 → markdown_exec-1.13.0}/tests/test_api.py +0 -0
  115. {markdown_exec-1.12.5 → markdown_exec-1.13.0}/tests/test_base_formatter.py +0 -0
  116. {markdown_exec-1.12.5 → markdown_exec-1.13.0}/tests/test_converter.py +0 -0
  117. {markdown_exec-1.12.5 → markdown_exec-1.13.0}/tests/test_headings.py +0 -0
  118. {markdown_exec-1.12.5 → markdown_exec-1.13.0}/tests/test_shell.py +0 -0
  119. {markdown_exec-1.12.5 → markdown_exec-1.13.0}/tests/test_validator.py +0 -0
  120. {markdown_exec-1.12.5 → markdown_exec-1.13.0}/zensical.toml +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.13.0](https://github.com/pawamoy/markdown-exec/releases/tag/1.13.0) - 2026-11-10
9
+
10
+ <small>[Compare with 1.12.6](https://github.com/pawamoy/markdown-exec/compare/1.12.6...1.13.0)</small>
11
+
12
+ ### Features
13
+
14
+ - Emulate Python REPL in pycon blocks ([b40bdc6](https://github.com/pawamoy/markdown-exec/commit/b40bdc62c4ff707eda5162b74af2608ae0960fa5) by Sydney Duckworth). [Issue-25](https://github.com/pawamoy/markdown-exec/issues/25), [PR-105](https://github.com/pawamoy/markdown-exec/pull/105)
15
+
16
+ ## [1.12.6](https://github.com/pawamoy/markdown-exec/releases/tag/1.12.6) - 2026-10-31
17
+
18
+ <small>[Compare with 1.12.5](https://github.com/pawamoy/markdown-exec/compare/1.12.5...1.12.6)</small>
19
+
20
+ ### Bug Fixes
21
+
22
+ - Resolve Zensical icons through the theme directory accessor ([6c69e7d](https://github.com/pawamoy/markdown-exec/commit/6c69e7ddd88afc6fb5960f1ecdd10f59a059949e) by David Hotham). [Issue-zensical-1111](https://github.com/zensical/zensical/issues/1111), [PR-109](https://github.com/pawamoy/markdown-exec/pull/109)
23
+
8
24
  ## [1.12.5](https://github.com/pawamoy/markdown-exec/releases/tag/1.12.5) - 2026-10-14
9
25
 
10
26
  <small>[Compare with 1.12.4](https://github.com/pawamoy/markdown-exec/compare/1.12.4...1.12.5)</small>
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: markdown-exec
3
- Version: 1.12.5
3
+ Version: 1.13.0
4
4
  Summary: Utilities to execute code blocks in Markdown files.
5
5
  Keywords: markdown,python,exec,shell,bash,mkdocs
6
6
  Author-Email: Timothée Mazzucotelli <dev@pawamoy.fr>
@@ -162,10 +162,6 @@ and the [gallery](https://pawamoy.github.io/markdown-exec/gallery/) for more exa
162
162
 
163
163
  <div id="premium-sponsors" style="text-align: center;">
164
164
 
165
- <div id="silver-sponsors"><b>Silver sponsors</b><p>
166
- <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>
167
- </p></div>
168
-
169
165
  <div id="bronze-sponsors"><b>Bronze sponsors</b><p>
170
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>
171
167
  </p></div>
@@ -179,6 +175,7 @@ and the [gallery](https://pawamoy.github.io/markdown-exec/gallery/) for more exa
179
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>
180
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>
181
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://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>
182
179
  <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>
183
180
  <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>
184
181
  <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>
@@ -197,7 +194,6 @@ and the [gallery](https://pawamoy.github.io/markdown-exec/gallery/) for more exa
197
194
  <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>
198
195
  <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>
199
196
  <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>
200
- <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>
201
197
  <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>
202
198
  <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>
203
199
  <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>
@@ -125,10 +125,6 @@ and the [gallery](https://pawamoy.github.io/markdown-exec/gallery/) for more exa
125
125
 
126
126
  <div id="premium-sponsors" style="text-align: center;">
127
127
 
128
- <div id="silver-sponsors"><b>Silver sponsors</b><p>
129
- <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>
130
- </p></div>
131
-
132
128
  <div id="bronze-sponsors"><b>Bronze sponsors</b><p>
133
129
  <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>
134
130
  </p></div>
@@ -142,6 +138,7 @@ and the [gallery](https://pawamoy.github.io/markdown-exec/gallery/) for more exa
142
138
  <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>
143
139
  <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>
144
140
  <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>
141
+ <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>
145
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>
146
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>
147
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>
@@ -160,7 +157,6 @@ and the [gallery](https://pawamoy.github.io/markdown-exec/gallery/) for more exa
160
157
  <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>
161
158
  <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
159
  <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/cmclaughlin"><img alt="cmclaughlin" src="https://avatars.githubusercontent.com/u/1061109?u=ddf6eec0edd2d11c980f8c3aa96e3d044d4e0468&v=4" style="height: 32px; border-radius: 100%;"></a>
164
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>
165
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>
166
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>
@@ -13,6 +13,7 @@ ignore = [
13
13
  "ANN401", # Dynamically typed expressions (typing.Any) are disallowed
14
14
  "ARG005", # Unused lambda argument
15
15
  "C901", # Too complex
16
+ "COM812", # Trailing comma, making formatting unstable
16
17
  "D105", # Missing docstring in magic method
17
18
  "D417", # Missing argument description in the docstring
18
19
  "E501", # Line too long
@@ -29,6 +29,18 @@ Welcome to our gallery of examples!
29
29
  ```
30
30
  ````
31
31
 
32
+ ### with [Highcharts](https://www.highcharts.com/)
33
+
34
+ > A JavaScript library for interactive charts.
35
+
36
+ This example generates chart options in Python and loads Highcharts from a CDN. Hover over the columns to see their values.
37
+
38
+ ````md exec="1" source="tabbed-right"
39
+ ```python exec="true" html="true" id="highcharts"
40
+ --8<-- "gallery/highcharts.py"
41
+ ```
42
+ ````
43
+
32
44
  ### with [Matplotlib](https://matplotlib.org/)
33
45
 
34
46
  > Matplotlib is a comprehensive library for creating static, animated, and interactive visualizations in Python.
@@ -85,6 +97,18 @@ pydeps uses [Graphviz](https://graphviz.org/) under the hood to generate graphs.
85
97
  ```
86
98
  ````
87
99
 
100
+ ### with [Vega](https://vega.github.io/vega/)
101
+
102
+ > A visualization grammar for interactive graphics.
103
+
104
+ This example generates a Vega specification in Python and loads Vega from a CDN. Hover over the bars to highlight them.
105
+
106
+ ````md exec="1" source="tabbed-right"
107
+ ```python exec="true" html="true" id="vega"
108
+ --8<-- "gallery/vega.py"
109
+ ```
110
+ ````
111
+
88
112
  ## Code snippets
89
113
 
90
114
  ### with [Rich](https://github.com/Textualize/rich)
@@ -0,0 +1,17 @@
1
+ import json
2
+
3
+ options = {
4
+ "chart": {"type": "column"},
5
+ "title": {"text": "Example bar chart"},
6
+ "xAxis": {"categories": ["a", "b", "c"]},
7
+ "yAxis": {"title": {"text": "Value"}},
8
+ "series": [{"name": "Values", "data": [1, 3, 2]}],
9
+ }
10
+
11
+ print(f"""
12
+ <div id="highcharts-chart" style="width: 100%; height: 300px;"></div>
13
+ <script src="https://cdn.jsdelivr.net/npm/highcharts@12/highcharts.js"></script>
14
+ <script>
15
+ Highcharts.chart('highcharts-chart', {json.dumps(options)});
16
+ </script>
17
+ """)
@@ -0,0 +1,59 @@
1
+ import json
2
+
3
+ spec = {
4
+ "$schema": "https://vega.github.io/schema/vega/v6.json",
5
+ "width": 400,
6
+ "height": 200,
7
+ "padding": 5,
8
+ "data": [{"name": "table", "values": [
9
+ {"category": "a", "amount": 1},
10
+ {"category": "b", "amount": 3},
11
+ {"category": "c", "amount": 2},
12
+ ]}],
13
+ "scales": [
14
+ {
15
+ "name": "x",
16
+ "type": "band",
17
+ "domain": {"data": "table", "field": "category"},
18
+ "range": "width",
19
+ "padding": 0.1,
20
+ },
21
+ {
22
+ "name": "y",
23
+ "domain": {"data": "table", "field": "amount"},
24
+ "range": "height",
25
+ "nice": True,
26
+ "zero": True,
27
+ },
28
+ ],
29
+ "axes": [
30
+ {"orient": "bottom", "scale": "x"},
31
+ {"orient": "left", "scale": "y", "tickMinStep": 1},
32
+ ],
33
+ "marks": [{
34
+ "type": "rect",
35
+ "from": {"data": "table"},
36
+ "encode": {
37
+ "enter": {
38
+ "x": {"scale": "x", "field": "category"},
39
+ "width": {"scale": "x", "band": 1},
40
+ "y": {"scale": "y", "field": "amount"},
41
+ "y2": {"scale": "y", "value": 0},
42
+ },
43
+ "update": {"fill": {"value": "steelblue"}},
44
+ "hover": {"fill": {"value": "orange"}},
45
+ },
46
+ }],
47
+ }
48
+
49
+ print(f"""
50
+ <div id="vega-chart"></div>
51
+ <script src="https://cdn.jsdelivr.net/npm/vega@6"></script>
52
+ <script>
53
+ new vega.View(vega.parse({json.dumps(spec)}), {{
54
+ renderer: 'svg',
55
+ container: '#vega-chart',
56
+ hover: true
57
+ }}).runAsync();
58
+ </script>
59
+ """)
@@ -0,0 +1,5 @@
1
+ >>> x = [3, 2, 1]
2
+ # Output from unassigned expressions is displayed without needing `print`
3
+ >>> sorted(x)
4
+ # `print` still works as normal
5
+ >>> print(x)
@@ -0,0 +1,73 @@
1
+ # Python
2
+
3
+ ## Regular Python
4
+
5
+ Python code is executed in the current process,
6
+ with isolated global variables.
7
+
8
+ To capture the output of your code, Markdown Exec patches the `print`
9
+ function so that it writes to a buffer instead of standard output.
10
+
11
+ ````md exec="1" source="tabbed-left" tabs="Markdown|Rendered"
12
+ ```python exec="1"
13
+ print("**Hello world!**")
14
+ ```
15
+ ````
16
+
17
+ See the [Gallery](../gallery.md) for more complex examples.
18
+
19
+ ## Python console code
20
+
21
+ Code blocks syntax-highlighted with the `pycon` identifier are also supported.
22
+ These code blocks will be pre-processed to keep only the lines
23
+ starting with `>>> `, and the chevrons (prompt) will be removed from these lines,
24
+ so we can execute them.
25
+
26
+ ````md exec="1" source="tabbed-left" tabs="Markdown|Rendered"
27
+ ```pycon exec="1" source="console"
28
+ --8<-- "usage/source.pycon"
29
+ ```
30
+ ````
31
+
32
+ It also means that multiple blocks of instructions will be concatenated,
33
+ as well as their output:
34
+
35
+ ````md exec="1" source="tabbed-left" tabs="Markdown|Rendered"
36
+ ```pycon exec="1" source="console"
37
+ --8<-- "usage/multiple.pycon"
38
+ ```
39
+ ````
40
+
41
+ ### Interactive console
42
+
43
+ When the `interactive` flag is set, `pycon` blocks will use an alternative formatter that mimics the behavior of the Python REPL interpreter.
44
+
45
+ In this mode outputs are displayed immediately after their source lines, rather than all outputs being shown at the end.
46
+ Additionally, outputs from unbound expressions are displayed automatically (although `print` can still be used as well).
47
+
48
+ ````md exec="1" source="tabbed-left" tabs="Markdown|Rendered"
49
+ ```pycon exec="1" interactive="1"
50
+ --8<-- "usage/interactive.pycon"
51
+ ```
52
+ ````
53
+
54
+ Exceptions are also handled differently: when a line raises an exception other lines in the same block are still executed and displayed as normal.
55
+ The raised exception is printed after the generating line and logged as a warning.
56
+
57
+ ````md exec="1" source="tabbed-left" tabs="Markdown|Rendered"
58
+ ```pycon exec="1" interactive="1" id="pycon_error"
59
+ >>> y = 2
60
+ >>> y / 0
61
+ >>> y * 2
62
+ ```
63
+ ````
64
+ === "MkDocs Log"
65
+ ```text
66
+ WARNING - markdown_exec: Unexpected exception while executing pycon code block 'pycon_error':
67
+
68
+ Traceback (most recent call last):
69
+ File "<code block: id pycon_error>", line 3, in <module>
70
+ >>> y / 0
71
+ ~~^~~
72
+ ZeroDivisionError: division by zero
73
+ ```
@@ -53,7 +53,7 @@ def pyprefix(title: str) -> str:
53
53
  def _get_changelog_version() -> str:
54
54
  changelog_version_re = re.compile(r"^## \[(\d+\.\d+\.\d+)\].*$")
55
55
  with Path(__file__).parent.joinpath("CHANGELOG.md").open("r", encoding="utf8") as file:
56
- return next(filter(bool, map(changelog_version_re.match, file))).group(1) # ty:ignore[unresolved-attribute]
56
+ return next(filter(bool, map(changelog_version_re.match, file))).group(1) # ty:ignore[missing-union-attribute]
57
57
 
58
58
 
59
59
  @duty
@@ -45,7 +45,7 @@ dependencies = [
45
45
  "markupsafe>=2",
46
46
  "pymdown-extensions>=9",
47
47
  ]
48
- version = "1.12.5"
48
+ version = "1.13.0"
49
49
 
50
50
  [project.optional-dependencies]
51
51
  ansi = [
@@ -120,7 +120,7 @@ docs = [
120
120
  "ghp-import>=2.1",
121
121
  "markdown-callouts>=0.4",
122
122
  "mkdocstrings[python]>=0.29",
123
- "zensical>=0.0.21",
123
+ "zensical>=0.0.41",
124
124
  "pydeps>=3.0; python_version == '3.12'",
125
125
  "diagrams>=0.24.1; python_version == '3.12'",
126
126
  "rich>=13.9; python_version == '3.12'",
@@ -65,7 +65,7 @@ def _extra_marker(req: Requirement) -> str | None:
65
65
  if not req.marker:
66
66
  return None
67
67
  try:
68
- return next(marker[2].value for marker in req.marker._markers if getattr(marker[0], "value", None) == "extra") # ty:ignore[unresolved-attribute]
68
+ return next(marker[2].value for marker in req.marker._markers if getattr(marker[0], "value", None) == "extra") # ty:ignore[missing-union-attribute]
69
69
  except StopIteration:
70
70
  return None
71
71
 
@@ -22,7 +22,7 @@ import re
22
22
  from contextlib import suppress
23
23
  from pathlib import Path
24
24
 
25
- from pdm.backend.hooks.version import ( # ty: ignore[unresolved-import]
25
+ from pdm.backend.hooks.version import ( # ty: ignore[import-not-found]
26
26
  SCMVersion,
27
27
  Version,
28
28
  default_version_formatter,
@@ -29,7 +29,7 @@ from textwrap import dedent
29
29
  from typing import TYPE_CHECKING, Any
30
30
 
31
31
  if TYPE_CHECKING:
32
- from collections.abc import Iterator
32
+ from collections.abc import Generator
33
33
 
34
34
 
35
35
  PYTHON_VERSIONS = os.getenv("PYTHON_VERSIONS", "3.11 3.12 3.13 3.14 3.15").split()
@@ -45,7 +45,7 @@ def shell(cmd: str, *, capture_output: bool = False, **kwargs: Any) -> str | Non
45
45
 
46
46
 
47
47
  @contextmanager
48
- def environ(**kwargs: str) -> Iterator[None]:
48
+ def environ(**kwargs: str) -> Generator[None]:
49
49
  """Temporarily set environment variables."""
50
50
  original = dict(os.environ)
51
51
  os.environ.update(kwargs)
@@ -18,9 +18,37 @@
18
18
 
19
19
  # Special module without future annotations for executing Python code.
20
20
 
21
+ import ast
21
22
  from typing import Any
22
23
 
23
24
 
24
25
  def exec_python(code: str, filename: str, exec_globals: dict[str, Any] | None = None) -> None:
25
26
  compiled = compile(code, filename=filename, mode="exec")
26
27
  exec(compiled, exec_globals) # noqa: S102
28
+
29
+
30
+ def exec_python_interactive(code: str, filename: str, exec_globals: dict) -> Any | None:
31
+ cmd = ast.parse(code, filename, "exec")
32
+
33
+ # Check if last statement is an unassigned expression whose result should be returned.
34
+ # Unassigned expressions *within* an input can be ignored,
35
+ # e.g. in `x = 2; x; x + 1` the second statement isn't output.
36
+ if cmd.body and isinstance(cmd.body[-1], ast.Expr):
37
+ expr = ast.Expression(cmd.body[-1].value)
38
+ stmts = cmd.body[:-1]
39
+ else:
40
+ expr = None
41
+ stmts = cmd.body
42
+
43
+ if stmts:
44
+ # Execute all statements that don't generate output.
45
+ exec( # noqa: S102
46
+ compile(ast.Module(stmts, []), filename, "exec"),
47
+ exec_globals,
48
+ )
49
+
50
+ if expr:
51
+ # Execute final expression and return result.
52
+ return eval(compile(expr, filename, "eval"), exec_globals) # noqa: S307
53
+
54
+ return None
@@ -33,7 +33,7 @@ from markdown_exec._internal.logger import get_logger
33
33
  from markdown_exec._internal.rendering import MarkdownConverter, add_source, code_block
34
34
 
35
35
  if TYPE_CHECKING:
36
- from collections.abc import Callable, Iterator
36
+ from collections.abc import Callable, Generator
37
37
 
38
38
  from markdown.core import Markdown
39
39
 
@@ -44,7 +44,7 @@ default_tabs = ("Source", "Result")
44
44
 
45
45
 
46
46
  @contextmanager
47
- def working_directory(path: str | None = None) -> Iterator[None]:
47
+ def working_directory(path: str | None = None) -> Generator[None]:
48
48
  """Change the working directory for the duration of the context.
49
49
 
50
50
  Parameters:
@@ -62,7 +62,7 @@ def working_directory(path: str | None = None) -> Iterator[None]:
62
62
 
63
63
 
64
64
  @contextmanager
65
- def console_width(width: int | None = None) -> Iterator[None]:
65
+ def console_width(width: int | None = None) -> Generator[None]:
66
66
  """Set the console width for the duration of the context.
67
67
 
68
68
  The console width is set using the `COLUMNS` environment variable.
@@ -124,6 +124,7 @@ def base_format(
124
124
  update_toc: bool = True,
125
125
  workdir: str | None = None,
126
126
  width: int | None = None,
127
+ interactive: bool = False,
127
128
  **options: Any,
128
129
  ) -> Markup:
129
130
  """Execute code and return HTML.
@@ -163,7 +164,14 @@ def base_format(
163
164
 
164
165
  try:
165
166
  with working_directory(workdir), console_width(width):
166
- output = run(source_input, returncode=returncode, session=session, id=id, **extra)
167
+ output = run(
168
+ source_input,
169
+ returncode=returncode,
170
+ session=session,
171
+ id=id,
172
+ interactive=interactive,
173
+ **extra,
174
+ )
167
175
  except ExecutionError as error:
168
176
  identifier = id or extra.get("title", "")
169
177
  identifier = identifier and f"'{identifier}' "
@@ -40,5 +40,13 @@ def _transform_source(code: str) -> tuple[str, str]:
40
40
  return python_code, "\n".join(pycon_lines)
41
41
 
42
42
 
43
- def _format_pycon(**kwargs: Any) -> Markup:
44
- return base_format(language="pycon", run=_run_python, transform_source=_transform_source, **kwargs)
43
+ def _format_pycon(*, interactive: bool = False, **kwargs: Any) -> Markup:
44
+ transform_source = _transform_source if not interactive else None
45
+
46
+ return base_format(
47
+ language="pycon",
48
+ run=_run_python,
49
+ transform_source=transform_source,
50
+ interactive=interactive,
51
+ **kwargs,
52
+ )