markdown-exec 1.9.3__tar.gz → 1.10.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.
Files changed (106) hide show
  1. {markdown_exec-1.9.3 → markdown_exec-1.10.1}/CHANGELOG.md +24 -0
  2. {markdown_exec-1.9.3 → markdown_exec-1.10.1}/CONTRIBUTING.md +7 -10
  3. {markdown_exec-1.9.3 → markdown_exec-1.10.1}/PKG-INFO +5 -8
  4. {markdown_exec-1.9.3 → markdown_exec-1.10.1}/README.md +1 -4
  5. {markdown_exec-1.9.3 → markdown_exec-1.10.1}/config/ruff.toml +1 -1
  6. {markdown_exec-1.9.3 → markdown_exec-1.10.1}/docs/.overrides/main.html +5 -3
  7. markdown_exec-1.10.1/docs/.overrides/partials/comments.html +57 -0
  8. {markdown_exec-1.9.3 → markdown_exec-1.10.1}/docs/gallery.md +15 -3
  9. markdown_exec-1.10.1/docs/index.md +6 -0
  10. {markdown_exec-1.9.3 → markdown_exec-1.10.1}/docs/insiders/index.md +8 -2
  11. {markdown_exec-1.9.3 → markdown_exec-1.10.1}/docs/insiders/installation.md +4 -4
  12. markdown_exec-1.10.1/docs/js/feedback.js +14 -0
  13. {markdown_exec-1.9.3 → markdown_exec-1.10.1}/docs/license.md +5 -0
  14. markdown_exec-1.10.1/docs/snippets/gallery/expandable_filetree.py +41 -0
  15. {markdown_exec-1.9.3 → markdown_exec-1.10.1}/docs/snippets/gallery/matplotlib.py +4 -4
  16. {markdown_exec-1.9.3 → markdown_exec-1.10.1}/docs/usage/index.md +9 -9
  17. {markdown_exec-1.9.3 → markdown_exec-1.10.1}/docs/usage/pyodide.md +12 -0
  18. {markdown_exec-1.9.3 → markdown_exec-1.10.1}/docs/usage/shell.md +2 -2
  19. {markdown_exec-1.9.3 → markdown_exec-1.10.1}/docs/usage/tree.md +1 -1
  20. {markdown_exec-1.9.3 → markdown_exec-1.10.1}/duties.py +38 -16
  21. {markdown_exec-1.9.3 → markdown_exec-1.10.1}/mkdocs.yml +19 -4
  22. {markdown_exec-1.9.3 → markdown_exec-1.10.1}/pyproject.toml +49 -8
  23. {markdown_exec-1.9.3 → markdown_exec-1.10.1}/scripts/gen_credits.py +6 -6
  24. markdown_exec-1.10.1/scripts/get_version.py +27 -0
  25. {markdown_exec-1.9.3 → markdown_exec-1.10.1}/scripts/insiders.py +5 -2
  26. markdown_exec-1.10.1/scripts/make +1 -0
  27. markdown_exec-1.10.1/scripts/make.py +191 -0
  28. {markdown_exec-1.9.3 → markdown_exec-1.10.1}/src/markdown_exec/formatters/_exec_python.py +2 -2
  29. {markdown_exec-1.9.3 → markdown_exec-1.10.1}/src/markdown_exec/formatters/base.py +3 -1
  30. {markdown_exec-1.9.3 → markdown_exec-1.10.1}/src/markdown_exec/formatters/bash.py +2 -2
  31. {markdown_exec-1.9.3 → markdown_exec-1.10.1}/src/markdown_exec/formatters/pyodide.py +3 -2
  32. {markdown_exec-1.9.3 → markdown_exec-1.10.1}/src/markdown_exec/formatters/python.py +1 -1
  33. {markdown_exec-1.9.3 → markdown_exec-1.10.1}/src/markdown_exec/formatters/sh.py +2 -2
  34. {markdown_exec-1.9.3 → markdown_exec-1.10.1}/src/markdown_exec/mkdocs_plugin.py +3 -1
  35. {markdown_exec-1.9.3 → markdown_exec-1.10.1}/src/markdown_exec/pyodide.css +6 -1
  36. {markdown_exec-1.9.3 → markdown_exec-1.10.1}/src/markdown_exec/rendering.py +4 -3
  37. {markdown_exec-1.9.3 → markdown_exec-1.10.1}/tests/conftest.py +1 -1
  38. {markdown_exec-1.9.3 → markdown_exec-1.10.1}/tests/test_base_formatter.py +3 -0
  39. markdown_exec-1.9.3/devdeps.txt +0 -49
  40. markdown_exec-1.9.3/docs/index.md +0 -1
  41. markdown_exec-1.9.3/scripts/make +0 -203
  42. {markdown_exec-1.9.3 → markdown_exec-1.10.1}/CODE_OF_CONDUCT.md +0 -0
  43. {markdown_exec-1.9.3 → markdown_exec-1.10.1}/LICENSE +0 -0
  44. {markdown_exec-1.9.3 → markdown_exec-1.10.1}/config/coverage.ini +0 -0
  45. {markdown_exec-1.9.3 → markdown_exec-1.10.1}/config/git-changelog.toml +0 -0
  46. {markdown_exec-1.9.3 → markdown_exec-1.10.1}/config/mypy.ini +0 -0
  47. {markdown_exec-1.9.3 → markdown_exec-1.10.1}/config/pytest.ini +0 -0
  48. {markdown_exec-1.9.3 → markdown_exec-1.10.1}/config/vscode/launch.json +0 -0
  49. {markdown_exec-1.9.3 → markdown_exec-1.10.1}/config/vscode/settings.json +0 -0
  50. {markdown_exec-1.9.3 → markdown_exec-1.10.1}/config/vscode/tasks.json +0 -0
  51. {markdown_exec-1.9.3 → markdown_exec-1.10.1}/docs/changelog.md +0 -0
  52. {markdown_exec-1.9.3 → markdown_exec-1.10.1}/docs/code_of_conduct.md +0 -0
  53. {markdown_exec-1.9.3 → markdown_exec-1.10.1}/docs/contributing.md +0 -0
  54. {markdown_exec-1.9.3 → markdown_exec-1.10.1}/docs/credits.md +0 -0
  55. {markdown_exec-1.9.3 → markdown_exec-1.10.1}/docs/css/insiders.css +0 -0
  56. {markdown_exec-1.9.3 → markdown_exec-1.10.1}/docs/css/material.css +0 -0
  57. {markdown_exec-1.9.3 → markdown_exec-1.10.1}/docs/css/mkdocstrings.css +0 -0
  58. {markdown_exec-1.9.3 → markdown_exec-1.10.1}/docs/insiders/changelog.md +0 -0
  59. {markdown_exec-1.9.3 → markdown_exec-1.10.1}/docs/insiders/goals.yml +0 -0
  60. {markdown_exec-1.9.3 → markdown_exec-1.10.1}/docs/js/insiders.js +0 -0
  61. {markdown_exec-1.9.3 → markdown_exec-1.10.1}/docs/schema.json +0 -0
  62. {markdown_exec-1.9.3 → markdown_exec-1.10.1}/docs/snippets/gallery/ansi.sh +0 -0
  63. {markdown_exec-1.9.3 → markdown_exec-1.10.1}/docs/snippets/gallery/argparse.py +0 -0
  64. {markdown_exec-1.9.3 → markdown_exec-1.10.1}/docs/snippets/gallery/argparse_format.py +0 -0
  65. {markdown_exec-1.9.3 → markdown_exec-1.10.1}/docs/snippets/gallery/chalk.py +0 -0
  66. {markdown_exec-1.9.3 → markdown_exec-1.10.1}/docs/snippets/gallery/d2.py +0 -0
  67. {markdown_exec-1.9.3 → markdown_exec-1.10.1}/docs/snippets/gallery/diagrams.py +0 -0
  68. {markdown_exec-1.9.3 → markdown_exec-1.10.1}/docs/snippets/gallery/drawsvg.py +0 -0
  69. {markdown_exec-1.9.3 → markdown_exec-1.10.1}/docs/snippets/gallery/hyperbolic.py +0 -0
  70. {markdown_exec-1.9.3 → markdown_exec-1.10.1}/docs/snippets/gallery/plotly.py +0 -0
  71. {markdown_exec-1.9.3 → markdown_exec-1.10.1}/docs/snippets/gallery/pydeps.py +0 -0
  72. {markdown_exec-1.9.3 → markdown_exec-1.10.1}/docs/snippets/gallery/pytermgui.py +0 -0
  73. {markdown_exec-1.9.3 → markdown_exec-1.10.1}/docs/snippets/gallery/qrcode.py +0 -0
  74. {markdown_exec-1.9.3 → markdown_exec-1.10.1}/docs/snippets/gallery/rich.py +0 -0
  75. {markdown_exec-1.9.3 → markdown_exec-1.10.1}/docs/snippets/gallery/rich_terminal.py +0 -0
  76. {markdown_exec-1.9.3 → markdown_exec-1.10.1}/docs/snippets/gallery/runpy.py +0 -0
  77. {markdown_exec-1.9.3 → markdown_exec-1.10.1}/docs/snippets/gallery/textual.py +0 -0
  78. {markdown_exec-1.9.3 → markdown_exec-1.10.1}/docs/snippets/usage/boolean_matrix.py +0 -0
  79. {markdown_exec-1.9.3 → markdown_exec-1.10.1}/docs/snippets/usage/hide.py +0 -0
  80. {markdown_exec-1.9.3 → markdown_exec-1.10.1}/docs/snippets/usage/multiple.pycon +0 -0
  81. {markdown_exec-1.9.3 → markdown_exec-1.10.1}/docs/snippets/usage/platform_html.py +0 -0
  82. {markdown_exec-1.9.3 → markdown_exec-1.10.1}/docs/snippets/usage/platform_md.py +0 -0
  83. {markdown_exec-1.9.3 → markdown_exec-1.10.1}/docs/snippets/usage/source.py +0 -0
  84. {markdown_exec-1.9.3 → markdown_exec-1.10.1}/docs/snippets/usage/source.pycon +0 -0
  85. {markdown_exec-1.9.3 → markdown_exec-1.10.1}/docs/usage/python.md +0 -0
  86. {markdown_exec-1.9.3 → markdown_exec-1.10.1}/scripts/gen_ref_nav.py +0 -0
  87. {markdown_exec-1.9.3 → markdown_exec-1.10.1}/src/markdown_exec/__init__.py +0 -0
  88. {markdown_exec-1.9.3 → markdown_exec-1.10.1}/src/markdown_exec/ansi.css +0 -0
  89. {markdown_exec-1.9.3 → markdown_exec-1.10.1}/src/markdown_exec/debug.py +0 -0
  90. {markdown_exec-1.9.3 → markdown_exec-1.10.1}/src/markdown_exec/formatters/__init__.py +0 -0
  91. {markdown_exec-1.9.3 → markdown_exec-1.10.1}/src/markdown_exec/formatters/console.py +0 -0
  92. {markdown_exec-1.9.3 → markdown_exec-1.10.1}/src/markdown_exec/formatters/markdown.py +0 -0
  93. {markdown_exec-1.9.3 → markdown_exec-1.10.1}/src/markdown_exec/formatters/pycon.py +0 -0
  94. {markdown_exec-1.9.3 → markdown_exec-1.10.1}/src/markdown_exec/formatters/tree.py +0 -0
  95. {markdown_exec-1.9.3 → markdown_exec-1.10.1}/src/markdown_exec/logger.py +0 -0
  96. {markdown_exec-1.9.3 → markdown_exec-1.10.1}/src/markdown_exec/processors.py +0 -0
  97. {markdown_exec-1.9.3 → markdown_exec-1.10.1}/src/markdown_exec/py.typed +0 -0
  98. {markdown_exec-1.9.3 → markdown_exec-1.10.1}/src/markdown_exec/pyodide.js +0 -0
  99. {markdown_exec-1.9.3 → markdown_exec-1.10.1}/tests/__init__.py +0 -0
  100. {markdown_exec-1.9.3 → markdown_exec-1.10.1}/tests/test_converter.py +0 -0
  101. {markdown_exec-1.9.3 → markdown_exec-1.10.1}/tests/test_headings.py +0 -0
  102. {markdown_exec-1.9.3 → markdown_exec-1.10.1}/tests/test_python.py +0 -0
  103. {markdown_exec-1.9.3 → markdown_exec-1.10.1}/tests/test_shell.py +0 -0
  104. {markdown_exec-1.9.3 → markdown_exec-1.10.1}/tests/test_toc.py +0 -0
  105. {markdown_exec-1.9.3 → markdown_exec-1.10.1}/tests/test_tree.py +0 -0
  106. {markdown_exec-1.9.3 → markdown_exec-1.10.1}/tests/test_validator.py +0 -0
@@ -5,6 +5,30 @@ 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.10.1](https://github.com/pawamoy/markdown-exec/releases/tag/1.10.1) - 2025-03-11
9
+
10
+ <small>[Compare with 1.10.0](https://github.com/pawamoy/markdown-exec/compare/1.10.0...1.10.1)</small>
11
+
12
+ ### Build
13
+
14
+ - Add lower bound to pygments-ansi-color extra ([a8e17c9](https://github.com/pawamoy/markdown-exec/commit/a8e17c9cd1bf9ba8ab5008a83c77a0b1208a1b25) by Timothée Mazzucotelli).
15
+
16
+ ### Bug Fixes
17
+
18
+ - Fix emoji display in pyodide fence for themes other than Material ([e09e9b2](https://github.com/pawamoy/markdown-exec/commit/e09e9b2005f9fe0599db7bc9f053e7227b824a6a) by Timothée Mazzucotelli). [Issue-83](https://github.com/pawamoy/markdown-exec/issues/83), [PR-84](https://github.com/pawamoy/markdown-exec/pull/84)
19
+
20
+ ## [1.10.0](https://github.com/pawamoy/markdown-exec/releases/tag/1.10.0) - 2024-12-06
21
+
22
+ <small>[Compare with 1.9.3](https://github.com/pawamoy/markdown-exec/compare/1.9.3...1.10.0)</small>
23
+
24
+ ### Build
25
+
26
+ - Drop support for Python 3.8 ([103bc1d](https://github.com/pawamoy/markdown-exec/commit/103bc1dc5f07f330b9e7ca4f052714350c52389d) by Timothée Mazzucotelli).
27
+
28
+ ### Features
29
+
30
+ - Allow setting Pyodide version ([912c8c7](https://github.com/pawamoy/markdown-exec/commit/912c8c75a5f579a949644f33bcead0b71e9637fd) by Andrew). [Issue-66](https://github.com/pawamoy/markdown-exec/issues/66), [PR-67](https://github.com/pawamoy/markdown-exec/pull/67), Co-authored-by: Timothée Mazzucotelli <dev@pawamoy.fr>
31
+
8
32
  ## [1.9.3](https://github.com/pawamoy/markdown-exec/releases/tag/1.9.3) - 2024-06-24
9
33
 
10
34
  <small>[Compare with 1.9.2](https://github.com/pawamoy/markdown-exec/compare/1.9.2...1.9.3)</small>
@@ -23,12 +23,11 @@ make setup
23
23
  > You can install it with:
24
24
  >
25
25
  > ```bash
26
- > python3 -m pip install --user pipx
27
- > pipx install uv
26
+ > curl -LsSf https://astral.sh/uv/install.sh | sh
28
27
  > ```
29
28
  >
30
29
  > Now you can try running `make setup` again,
31
- > or simply `uv install`.
30
+ > or simply `uv sync`.
32
31
 
33
32
  You now have the dependencies installed.
34
33
 
@@ -36,13 +35,11 @@ Run `make help` to see all the available actions!
36
35
 
37
36
  ## Tasks
38
37
 
39
- This project uses [duty](https://github.com/pawamoy/duty) to run tasks.
40
- A Makefile is also provided. The Makefile will try to run certain tasks
41
- on multiple Python versions. If for some reason you don't want to run the task
42
- on multiple Python versions, you run the task directly with `make run duty TASK`.
43
-
44
- The Makefile detects if a virtual environment is activated,
45
- so `make` will work the same with the virtualenv activated or not.
38
+ The entry-point to run commands and tasks is the `make` Python script,
39
+ located in the `scripts` directory. Try running `make` to show the available commands and tasks.
40
+ The *commands* do not need the Python dependencies to be installed,
41
+ while the *tasks* do.
42
+ The cross-platform tasks are written in Python, thanks to [duty](https://github.com/pawamoy/duty).
46
43
 
47
44
  If you work in VSCode, we provide
48
45
  [an action to configure VSCode](https://pawamoy.github.io/copier-uv/work/#vscode-setup)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: markdown-exec
3
- Version: 1.9.3
3
+ Version: 1.10.1
4
4
  Summary: Utilities to execute code blocks in Markdown files.
5
5
  Keywords: markdown,python,exec,shell,bash,mkdocs
6
6
  Author-Email: =?utf-8?q?Timoth=C3=A9e_Mazzucotelli?= <dev@pawamoy.fr>
@@ -10,12 +10,12 @@ Classifier: Intended Audience :: Developers
10
10
  Classifier: Programming Language :: Python
11
11
  Classifier: Programming Language :: Python :: 3
12
12
  Classifier: Programming Language :: Python :: 3 :: Only
13
- Classifier: Programming Language :: Python :: 3.8
14
13
  Classifier: Programming Language :: Python :: 3.9
15
14
  Classifier: Programming Language :: Python :: 3.10
16
15
  Classifier: Programming Language :: Python :: 3.11
17
16
  Classifier: Programming Language :: Python :: 3.12
18
17
  Classifier: Programming Language :: Python :: 3.13
18
+ Classifier: Programming Language :: Python :: 3.14
19
19
  Classifier: Topic :: Documentation
20
20
  Classifier: Topic :: Software Development
21
21
  Classifier: Topic :: Utilities
@@ -28,10 +28,10 @@ Project-URL: Issues, https://github.com/pawamoy/markdown-exec/issues
28
28
  Project-URL: Discussions, https://github.com/pawamoy/markdown-exec/discussions
29
29
  Project-URL: Gitter, https://gitter.im/markdown-exec/community
30
30
  Project-URL: Funding, https://github.com/sponsors/pawamoy
31
- Requires-Python: >=3.8
31
+ Requires-Python: >=3.9
32
32
  Requires-Dist: pymdown-extensions>=9
33
- Requires-Dist: pygments-ansi-color; extra == "ansi"
34
33
  Provides-Extra: ansi
34
+ Requires-Dist: pygments-ansi-color>=0.3; extra == "ansi"
35
35
  Description-Content-Type: text/markdown
36
36
 
37
37
  # Markdown Exec
@@ -39,7 +39,6 @@ Description-Content-Type: text/markdown
39
39
  [![ci](https://github.com/pawamoy/markdown-exec/workflows/ci/badge.svg)](https://github.com/pawamoy/markdown-exec/actions?query=workflow%3Aci)
40
40
  [![documentation](https://img.shields.io/badge/docs-mkdocs-708FCC.svg?style=flat)](https://pawamoy.github.io/markdown-exec/)
41
41
  [![pypi version](https://img.shields.io/pypi/v/markdown-exec.svg)](https://pypi.org/project/markdown-exec/)
42
- [![gitpod](https://img.shields.io/badge/gitpod-workspace-708FCC.svg?style=flat)](https://gitpod.io/#https://github.com/pawamoy/markdown-exec)
43
42
  [![gitter](https://badges.gitter.im/join%20chat.svg)](https://app.gitter.im/#/room/#markdown-exec:gitter.im)
44
43
 
45
44
  Utilities to execute code blocks in Markdown files.
@@ -49,10 +48,8 @@ and this HTML is injected in place of the code block.
49
48
 
50
49
  ## Installation
51
50
 
52
- With `pip`:
53
-
54
51
  ```bash
55
- pip install markdown-exec[ansi]
52
+ pip install "markdown-exec[ansi]"
56
53
  ```
57
54
 
58
55
  The `ansi` extra provides the necessary bits (`pygments-ansi-color` and a CSS file)
@@ -3,7 +3,6 @@
3
3
  [![ci](https://github.com/pawamoy/markdown-exec/workflows/ci/badge.svg)](https://github.com/pawamoy/markdown-exec/actions?query=workflow%3Aci)
4
4
  [![documentation](https://img.shields.io/badge/docs-mkdocs-708FCC.svg?style=flat)](https://pawamoy.github.io/markdown-exec/)
5
5
  [![pypi version](https://img.shields.io/pypi/v/markdown-exec.svg)](https://pypi.org/project/markdown-exec/)
6
- [![gitpod](https://img.shields.io/badge/gitpod-workspace-708FCC.svg?style=flat)](https://gitpod.io/#https://github.com/pawamoy/markdown-exec)
7
6
  [![gitter](https://badges.gitter.im/join%20chat.svg)](https://app.gitter.im/#/room/#markdown-exec:gitter.im)
8
7
 
9
8
  Utilities to execute code blocks in Markdown files.
@@ -13,10 +12,8 @@ and this HTML is injected in place of the code block.
13
12
 
14
13
  ## Installation
15
14
 
16
- With `pip`:
17
-
18
15
  ```bash
19
- pip install markdown-exec[ansi]
16
+ pip install "markdown-exec[ansi]"
20
17
  ```
21
18
 
22
19
  The `ansi` extra provides the necessary bits (`pygments-ansi-color` and a CSS file)
@@ -1,4 +1,4 @@
1
- target-version = "py38"
1
+ target-version = "py39"
2
2
  line-length = 120
3
3
 
4
4
  [lint]
@@ -2,17 +2,19 @@
2
2
 
3
3
  {% block announce %}
4
4
 
5
- <a href="{{ 'insiders/#how-to-become-a-sponsor' | url }}"><strong>Sponsorship</strong></a>
6
- is now available!
5
+ <strong>Fund this project</strong> through
6
+ <a href="{{ 'insiders/#how-to-become-a-sponsor' | url }}"><strong>sponsorship</strong></a>
7
7
  <span class="twemoji heart pulse">
8
8
  {% include ".icons/octicons/heart-fill-16.svg" %}
9
9
  </span> &mdash;
10
10
 
11
- For updates follow <strong>@pawamoy</strong> on
11
+ Follow
12
+ <strong>@pawamoy</strong> on
12
13
  <a rel="me" href="https://fosstodon.org/@pawamoy">
13
14
  <span class="twemoji mastodon">
14
15
  {% include ".icons/fontawesome/brands/mastodon.svg" %}
15
16
  </span>
16
17
  <strong>Fosstodon</strong>
17
18
  </a>
19
+ for updates
18
20
  {% endblock %}
@@ -0,0 +1,57 @@
1
+ <!-- Giscus -->
2
+ <!-- https://squidfunk.github.io/mkdocs-material/setup/adding-a-comment-system/#giscus-integration -->
3
+ <div id="feedback" style="display: none;">
4
+ <h2 id="__comments">Feedback</h2>
5
+ <script src="https://giscus.app/client.js"
6
+ data-repo="pawamoy/markdown-exec"
7
+ data-repo-id="R_kgDOG1IOMQ"
8
+ data-category="Documentation"
9
+ data-category-id="DIC_kwDOG1IOMc4Ck2cD"
10
+ data-mapping="pathname"
11
+ data-strict="1"
12
+ data-reactions-enabled="0"
13
+ data-emit-metadata="0"
14
+ data-input-position="top"
15
+ data-theme="preferred_color_scheme"
16
+ data-lang="en"
17
+ data-loading="lazy"
18
+ crossorigin="anonymous"
19
+ async>
20
+ </script>
21
+
22
+ <!-- Synchronize Giscus theme with palette -->
23
+ <script>
24
+ var giscus = document.querySelector("script[src*=giscus]")
25
+
26
+ // Set palette on initial load
27
+ var palette = __md_get("__palette")
28
+ if (palette && typeof palette.color === "object") {
29
+ var theme = palette.color.scheme === "slate"
30
+ ? "transparent_dark"
31
+ : "light"
32
+
33
+ // Instruct Giscus to set theme
34
+ giscus.setAttribute("data-theme", theme)
35
+ }
36
+
37
+ // Register event handlers after documented loaded
38
+ document.addEventListener("DOMContentLoaded", function() {
39
+ var ref = document.querySelector("[data-md-component=palette]")
40
+ ref.addEventListener("change", function() {
41
+ var palette = __md_get("__palette")
42
+ if (palette && typeof palette.color === "object") {
43
+ var theme = palette.color.scheme === "slate"
44
+ ? "transparent_dark"
45
+ : "light"
46
+
47
+ // Instruct Giscus to change theme
48
+ var frame = document.querySelector(".giscus-frame")
49
+ frame.contentWindow.postMessage(
50
+ { giscus: { setConfig: { theme } } },
51
+ "https://giscus.app"
52
+ )
53
+ }
54
+ })
55
+ })
56
+ </script>
57
+ </div>
@@ -21,7 +21,7 @@ Welcome to our gallery of examples!
21
21
 
22
22
  ### with [D2](https://d2lang.com/)
23
23
 
24
- > A modern diagram scripting language that turns text to diagrams.
24
+ > A modern diagram scripting language that turns text to diagrams.
25
25
 
26
26
  ````md exec="1" source="tabbed-right"
27
27
  ```python exec="true" html="true"
@@ -184,6 +184,20 @@ If you installed Markdown Exec with the `ansi` extra (`pip install markdown-exec
184
184
  ```
185
185
  ````
186
186
 
187
+ ## File-trees
188
+
189
+ This example displays a file-tree of the current project, in which you can descend thanks to Material for MkDocs' [code annotations](https://squidfunk.github.io/mkdocs-material/reference/code-blocks/#code-annotations). It uses a recursive Python function which accept a code block session name as parameter 🤯:
190
+
191
+ ````md exec="1" source="tabbed-right"
192
+ ```python exec="1" session="filetree"
193
+ --8<-- "gallery/expandable_filetree.py"
194
+ ```
195
+
196
+ ```python exec="1" session="filetree"
197
+ exptree(".", "filetree")
198
+ ```
199
+ ````
200
+
187
201
  ## Python CLI documentation
188
202
 
189
203
  ### with [`argparse`](https://docs.python.org/3/library/argparse.html#module-argparse) (code block)
@@ -206,8 +220,6 @@ In this example, we inspect the `argparse` parser to build better-looking Markdo
206
220
  ```
207
221
  ````
208
222
 
209
- ## Other techniques
210
-
211
223
  ### with [`runpy`](https://docs.python.org/3/library/runpy.html#module-runpy)
212
224
 
213
225
  This example uses Python's `runpy` module to run another Python module. This other module's output is captured by temporarily patching `sys.stdout` with a text buffer.
@@ -0,0 +1,6 @@
1
+ ---
2
+ hide:
3
+ - feedback
4
+ ---
5
+
6
+ --8<-- "README.md"
@@ -88,6 +88,8 @@ else:
88
88
  ```
89
89
  <!-- blacken-docs:on -->
90
90
 
91
+ Additionally, your sponsorship will give more weight to your upvotes on issues, helping us prioritize work items in our backlog. For more information on how we prioritize work, see this page: [Backlog management](https://pawamoy.github.io/backlog/).
92
+
91
93
  ## How to become a sponsor
92
94
 
93
95
  Thanks for your interest in sponsoring! In order to become an eligible sponsor
@@ -95,6 +97,10 @@ with your GitHub account, visit [pawamoy's sponsor profile][github sponsor profi
95
97
  and complete a sponsorship of **$10 a month or more**.
96
98
  You can use your individual or organization GitHub account for sponsoring.
97
99
 
100
+ Sponsorships lower than $10 a month are also very much appreciated, and useful.
101
+ They won't grant you access to Insiders, but they will be counted towards reaching sponsorship goals.
102
+ *Every* sponsorship helps us implementing new features and releasing them to the public.
103
+
98
104
  **Important**: If you're sponsoring **[@pawamoy][github sponsor profile]**
99
105
  through a GitHub organization, please send a short email
100
106
  to insiders@pawamoy.fr with the name of your
@@ -152,7 +158,7 @@ You can cancel your sponsorship anytime.[^5]
152
158
 
153
159
  The following section lists all funding goals. Each goal contains a list of
154
160
  features prefixed with a checkmark symbol, denoting whether a feature is
155
- :octicons-check-circle-fill-24:{ style="color: #00e676" } already available or
161
+ :octicons-check-circle-fill-24:{ style="color: #00e676" } already available or
156
162
  :octicons-check-circle-fill-24:{ style="color: var(--md-default-fg-color--lightest)" } planned,
157
163
  but not yet implemented. When the funding goal is hit,
158
164
  the features are released for general availability.
@@ -212,7 +218,7 @@ by the [ISC License][license]. However, we kindly ask you to respect our
212
218
 
213
219
  - Please **don't distribute the source code** of Insiders. You may freely use
214
220
  it for public, private or commercial projects, privately fork or mirror it,
215
- but please don't make the source code public, as it would counteract the
221
+ but please don't make the source code public, as it would counteract the
216
222
  sponsorware strategy.
217
223
 
218
224
  - If you cancel your subscription, you're automatically removed as a
@@ -42,21 +42,21 @@ Or using HTTPS:
42
42
  pip install git+https://${GH_TOKEN}@github.com/pawamoy-insiders/markdown-exec.git
43
43
  ```
44
44
 
45
- >? NOTE: **How to get a GitHub personal access token**
45
+ >? NOTE: **How to get a GitHub personal access token**
46
46
  > The `GH_TOKEN` environment variable is a GitHub token.
47
47
  > It can be obtained by creating a [personal access token] for
48
48
  > your GitHub account. It will give you access to the Insiders repository,
49
49
  > programmatically, from the command line or GitHub Actions workflows:
50
- >
50
+ >
51
51
  > 1. Go to https://github.com/settings/tokens
52
52
  > 2. Click on [Generate a new token]
53
53
  > 3. Enter a name and select the [`repo`][scopes] scope
54
54
  > 4. Generate the token and store it in a safe place
55
- >
55
+ >
56
56
  > [personal access token]: https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token
57
57
  > [Generate a new token]: https://github.com/settings/tokens/new
58
58
  > [scopes]: https://docs.github.com/en/developers/apps/scopes-for-oauth-apps#available-scopes
59
- >
59
+ >
60
60
  > Note that the personal access
61
61
  > token must be kept secret at all times, as it allows the owner to access your
62
62
  > private repositories.
@@ -0,0 +1,14 @@
1
+ const feedback = document.forms.feedback;
2
+ feedback.hidden = false;
3
+
4
+ feedback.addEventListener("submit", function(ev) {
5
+ ev.preventDefault();
6
+ const commentElement = document.getElementById("feedback");
7
+ commentElement.style.display = "block";
8
+ feedback.firstElementChild.disabled = true;
9
+ const data = ev.submitter.getAttribute("data-md-value");
10
+ const note = feedback.querySelector(".md-feedback__note [data-md-value='" + data + "']");
11
+ if (note) {
12
+ note.hidden = false;
13
+ }
14
+ })
@@ -1,3 +1,8 @@
1
+ ---
2
+ hide:
3
+ - feedback
4
+ ---
5
+
1
6
  # License
2
7
 
3
8
  ```
@@ -0,0 +1,41 @@
1
+ from fnmatch import fnmatch
2
+ from pathlib import Path
3
+
4
+ exclude = {"dist", "*cache*", ".devbox", ".hypothesis", ".pdm*", ".coverage*", "profile.*"}
5
+ no_recurse = {".venv*", "site", "htmlcov", ".git"}
6
+
7
+
8
+ def exptree(path: str, session: str) -> None:
9
+ # List files and directories separately.
10
+ files = []
11
+ dirs = []
12
+ for node in Path(path).iterdir():
13
+ if any(fnmatch(node.name, pattern) for pattern in exclude):
14
+ continue
15
+ if node.is_dir():
16
+ dirs.append(node)
17
+ else:
18
+ files.append(node)
19
+
20
+ # Print directories first, then files (both sorted).
21
+ recurse = []
22
+ print("```tree")
23
+ for directory in sorted(dirs):
24
+ if any(fnmatch(directory.name, pattern) for pattern in no_recurse):
25
+ print(f"{directory.name}/")
26
+ else:
27
+ recurse.append(directory.name)
28
+ # Add code annotation at the end.
29
+ print(f"{directory.name}/ # ({len(recurse)})!")
30
+ for file in sorted(files):
31
+ print(file.name)
32
+ print("```\n")
33
+
34
+ # Print contents of each annotated directory.
35
+ for index, directory in enumerate(recurse, 1):
36
+ new_path = f"{path}/{directory}"
37
+ print(f"{index}. \n")
38
+ # The recursive part!
39
+ print(f' ```python exec="1" session="{session}"')
40
+ print(f' exptree("{new_path}", "{session}")')
41
+ print(" ```\n")
@@ -8,14 +8,14 @@ import numpy as np
8
8
  # Load a numpy record array from yahoo csv data with fields date, open, close,
9
9
  # volume, adj_close from the mpl-data/example directory. The record array
10
10
  # stores the date as an np.datetime64 with a day unit ('D') in the date column.
11
- price_data = cbook.get_sample_data("goog.npz", np_load=True)["price_data"].view(np.recarray)
11
+ price_data = cbook.get_sample_data("goog.npz")["price_data"]
12
12
  price_data = price_data[-250:] # get the most recent 250 trading days
13
13
 
14
- delta1 = np.diff(price_data.adj_close) / price_data.adj_close[:-1]
14
+ delta1 = np.diff(price_data["adj_close"]) / price_data["adj_close"][:-1]
15
15
 
16
16
  # Marker size in units of points^2
17
- volume = (15 * price_data.volume[:-2] / price_data.volume[0]) ** 2
18
- close = 0.003 * price_data.close[:-2] / 0.003 * price_data.open[:-2]
17
+ volume = (15 * price_data["volume"][:-2] / price_data["volume"][0])**2
18
+ close = 0.003 * price_data["close"][:-2] / 0.003 * price_data["open"][:-2]
19
19
 
20
20
  fig, ax = plt.subplots()
21
21
  ax.scatter(delta1[:-1], delta1[1:], c=close, s=volume, alpha=0.5)
@@ -171,7 +171,7 @@ with one of the following values:
171
171
  ```
172
172
  ````
173
173
 
174
- NOTE: **Important**
174
+ NOTE: **Important:**
175
175
  The `material-block` source option requires that you enable the [`md_in_html`][md_in_html] Markdown extension.
176
176
 
177
177
  ---
@@ -184,7 +184,7 @@ The `material-block` source option requires that you enable the [`md_in_html`][m
184
184
  ```
185
185
  ````
186
186
 
187
- NOTE: **Important**
187
+ NOTE: **Important:**
188
188
  The `tabbed-left` source option requires that you enable the [`pymdownx.tabbed`][pymdownx.tabbed] Markdown extension.
189
189
 
190
190
  ---
@@ -197,7 +197,7 @@ The `tabbed-left` source option requires that you enable the [`pymdownx.tabbed`]
197
197
  ```
198
198
  ````
199
199
 
200
- NOTE: **Important**
200
+ NOTE: **Important:**
201
201
  The `tabbed-left` source option requires that you enable the [`pymdownx.tabbed`][pymdownx.tabbed] Markdown extension.
202
202
 
203
203
  ---
@@ -258,7 +258,7 @@ and the "Result" tab title second. It allows to switch from tabbed-left
258
258
  to tabbed-right and inversely without having to switch the titles as well.
259
259
 
260
260
 
261
- WARNING: **Limitation**
261
+ WARNING: **Limitation:**
262
262
  Changing the title for only one tab is not supported.
263
263
 
264
264
  ## Wrap result in a code block
@@ -271,7 +271,7 @@ $ cat .git/config
271
271
  ```
272
272
  ````
273
273
 
274
- WARNING: **Limitation**
274
+ WARNING: **Limitation:**
275
275
  Wrapping the result is not possible when HTML output is enabled.
276
276
 
277
277
  ## Change the console width
@@ -380,7 +380,7 @@ assert 1 + 1 == 11
380
380
  WARNING - markdown_exec: Execution of python code block 'print hello' exited with errors
381
381
  ```
382
382
 
383
- > TIP: **Titles act as IDs as well!**
383
+ > TIP: **Titles act as IDs as well!**
384
384
  > You *don't need* to provide an ID
385
385
  > if you already set a (Material for MkDocs) title:
386
386
  >
@@ -413,7 +413,7 @@ greet("Ping")
413
413
  ```
414
414
  ````
415
415
 
416
- WARNING: **Limitation**
416
+ WARNING: **Limitation:**
417
417
  Sessions only work with Python and Pycon syntax for now.
418
418
 
419
419
  ## Literate Markdown
@@ -435,9 +435,9 @@ That makes for a very meta-markdown markup:
435
435
  ```
436
436
  ````
437
437
 
438
- > TIP: **So power, such meta**
438
+ > TIP: **So power, such meta.**
439
439
  > The above example (both tabs) was entirely generated using *a literate code block in a literate code block* 🤯:
440
- >
440
+ >
441
441
  > `````md
442
442
  > ````md exec="1" source="tabbed-left"
443
443
  > ```md exec="1" source="material-block" title="Markdown link"
@@ -33,6 +33,18 @@ cowsay.cow("Hello World")
33
33
  Packages installed with Micropip are cached by the browser as well,
34
34
  making future installations much faster.
35
35
 
36
+ ## Pyodide version
37
+
38
+ You can select a specific Pyodide version with the `version` option:
39
+
40
+ ````md
41
+ ```pyodide version="0.26.4"
42
+ print("Hello.")
43
+ ```
44
+ ````
45
+
46
+ NOTE: **All Pyodide blocks on the same page should use the same version!**
47
+
36
48
  ## Sessions
37
49
 
38
50
  Editors with the same session share the same `globals()` dictionary,
@@ -2,7 +2,7 @@
2
2
 
3
3
  Shell code blocks are executed using the same interpreter specified
4
4
  as language of the code block, in sub-processes. The output is captured
5
- and rendered as Markdown or HTML (see [Usage](../index.md#html-vs-markdown)).
5
+ and rendered as Markdown or HTML (see [Usage](index.md#html-vs-markdown)).
6
6
 
7
7
  ## Bash
8
8
 
@@ -360,7 +360,7 @@ so we cannot provide generic guidance here.
360
360
  > when using our MkDocs plugin and enabling ANSI support,
361
361
  > to help tools like MkDocs and its `get-deps` command
362
362
  > know that the `ansi` extra dependency is required.
363
- >
363
+ >
364
364
  > ```yaml
365
365
  > plugins:
366
366
  > - markdown-exec:
@@ -70,5 +70,5 @@ root1
70
70
 
71
71
  It is recommended to always append trailing slashes to directory anyway.
72
72
 
73
- WARNING: **Limitation**
73
+ WARNING: **Limitation:**
74
74
  Spaces in file names are not supported when searching for a trailing slash.
@@ -7,11 +7,13 @@ import sys
7
7
  from contextlib import contextmanager
8
8
  from importlib.metadata import version as pkgversion
9
9
  from pathlib import Path
10
- from typing import TYPE_CHECKING, Iterator
10
+ from typing import TYPE_CHECKING
11
11
 
12
12
  from duty import duty, tools
13
13
 
14
14
  if TYPE_CHECKING:
15
+ from collections.abc import Iterator
16
+
15
17
  from duty.context import Context
16
18
 
17
19
 
@@ -43,10 +45,6 @@ def material_insiders() -> Iterator[bool]: # noqa: D103
43
45
  yield False
44
46
 
45
47
 
46
- below_312 = sys.version_info < (3, 12)
47
- skip_docs_reason = pyprefix("Building docs is not supported on Python 3.12, skipping")
48
-
49
-
50
48
  @duty
51
49
  def changelog(ctx: Context, bump: str = "") -> None:
52
50
  """Update the changelog in-place with latest commits.
@@ -57,8 +55,8 @@ def changelog(ctx: Context, bump: str = "") -> None:
57
55
  ctx.run(tools.git_changelog(bump=bump or None), title="Updating changelog")
58
56
 
59
57
 
60
- @duty(pre=["check_quality", "check_types", "check_docs", "check_dependencies", "check-api"])
61
- def check(ctx: Context) -> None: # noqa: ARG001
58
+ @duty(pre=["check-quality", "check-types", "check-docs", "check-api"])
59
+ def check(ctx: Context) -> None:
62
60
  """Check it all!"""
63
61
 
64
62
 
@@ -71,7 +69,7 @@ def check_quality(ctx: Context) -> None:
71
69
  )
72
70
 
73
71
 
74
- @duty(skip_if=not below_312, skip_reason=skip_docs_reason)
72
+ @duty(skip_if=sys.version_info[:2] != (3, 12), skip_reason="Docs build only on Python 3.12")
75
73
  def check_docs(ctx: Context) -> None:
76
74
  """Check if the documentation builds correctly."""
77
75
  Path("htmlcov").mkdir(parents=True, exist_ok=True)
@@ -86,6 +84,7 @@ def check_docs(ctx: Context) -> None:
86
84
  @duty
87
85
  def check_types(ctx: Context) -> None:
88
86
  """Check that the code is correctly typed."""
87
+ os.environ["FORCE_COLOR"] = "1"
89
88
  ctx.run(
90
89
  tools.mypy(*PY_SRC_LIST, config_file="config/mypy.ini"),
91
90
  title=pyprefix("Type-checking"),
@@ -102,7 +101,7 @@ def check_api(ctx: Context, *cli_args: str) -> None:
102
101
  )
103
102
 
104
103
 
105
- @duty(skip_if=not below_312, skip_reason=skip_docs_reason)
104
+ @duty
106
105
  def docs(ctx: Context, *cli_args: str, host: str = "127.0.0.1", port: int = 8000) -> None:
107
106
  """Serve the documentation (localhost:8000).
108
107
 
@@ -118,17 +117,40 @@ def docs(ctx: Context, *cli_args: str, host: str = "127.0.0.1", port: int = 8000
118
117
  )
119
118
 
120
119
 
121
- @duty(skip_if=not below_312, skip_reason=skip_docs_reason)
122
- def docs_deploy(ctx: Context) -> None:
123
- """Deploy the documentation to GitHub pages."""
120
+ @duty
121
+ def docs_deploy(ctx: Context, *, force: bool = False) -> None:
122
+ """Deploy the documentation to GitHub pages.
123
+
124
+ Parameters:
125
+ force: Whether to force deployment, even from non-Insiders version.
126
+ """
124
127
  os.environ["DEPLOY"] = "true"
125
128
  with material_insiders() as insiders:
126
129
  if not insiders:
127
130
  ctx.run(lambda: False, title="Not deploying docs without Material for MkDocs Insiders!")
128
- ctx.run(
129
- tools.mkdocs.gh_deploy(force=True),
130
- title="Deploying documentation",
131
- )
131
+ origin = ctx.run("git config --get remote.origin.url", silent=True, allow_overrides=False)
132
+ if "pawamoy-insiders/markdown-exec" in origin:
133
+ ctx.run(
134
+ "git remote add upstream git@github.com:pawamoy/markdown-exec",
135
+ silent=True,
136
+ nofail=True,
137
+ allow_overrides=False,
138
+ )
139
+ ctx.run(
140
+ tools.mkdocs.gh_deploy(remote_name="upstream", force=True),
141
+ title="Deploying documentation",
142
+ )
143
+ elif force:
144
+ ctx.run(
145
+ tools.mkdocs.gh_deploy(force=True),
146
+ title="Deploying documentation",
147
+ )
148
+ else:
149
+ ctx.run(
150
+ lambda: False,
151
+ title="Not deploying docs from public repository (do that from insiders instead!)",
152
+ nofail=True,
153
+ )
132
154
 
133
155
 
134
156
  @duty