markdown-exec 1.12.2__tar.gz → 1.12.3__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 (118) hide show
  1. markdown_exec-1.12.3/AI_POLICY.md +15 -0
  2. {markdown_exec-1.12.2 → markdown_exec-1.12.3}/CHANGELOG.md +13 -0
  3. {markdown_exec-1.12.2 → markdown_exec-1.12.3}/CONTRIBUTING.md +6 -16
  4. {markdown_exec-1.12.2 → markdown_exec-1.12.3}/LICENSE +1 -1
  5. {markdown_exec-1.12.2 → markdown_exec-1.12.3}/PKG-INFO +13 -8
  6. {markdown_exec-1.12.2 → markdown_exec-1.12.3}/README.md +12 -7
  7. {markdown_exec-1.12.2 → markdown_exec-1.12.3}/config/ruff.toml +9 -24
  8. markdown_exec-1.12.3/config/ty.toml +6 -0
  9. {markdown_exec-1.12.2 → markdown_exec-1.12.3}/config/vscode/launch.json +1 -2
  10. {markdown_exec-1.12.2 → markdown_exec-1.12.3}/config/vscode/settings.json +1 -3
  11. {markdown_exec-1.12.2 → markdown_exec-1.12.3}/docs/.overrides/partials/comments.html +1 -1
  12. markdown_exec-1.12.3/docs/css/apidocs.css +21 -0
  13. {markdown_exec-1.12.2 → markdown_exec-1.12.3}/docs/gallery.md +18 -18
  14. {markdown_exec-1.12.2 → markdown_exec-1.12.3}/docs/snippets/gallery/matplotlib.py +5 -2
  15. markdown_exec-1.12.3/docs/snippets/gallery/pydeps.py +19 -0
  16. {markdown_exec-1.12.2 → markdown_exec-1.12.3}/docs/usage/index.md +16 -26
  17. {markdown_exec-1.12.2 → markdown_exec-1.12.3}/docs/usage/pyodide.md +15 -35
  18. {markdown_exec-1.12.2 → markdown_exec-1.12.3}/docs/usage/shell.md +2 -2
  19. {markdown_exec-1.12.2 → markdown_exec-1.12.3}/docs/usage/tree.md +8 -0
  20. {markdown_exec-1.12.2 → markdown_exec-1.12.3}/duties.py +38 -43
  21. {markdown_exec-1.12.2 → markdown_exec-1.12.3}/pyproject.toml +7 -13
  22. {markdown_exec-1.12.2 → markdown_exec-1.12.3}/scripts/gen_credits.py +14 -15
  23. {markdown_exec-1.12.2 → markdown_exec-1.12.3}/scripts/make.py +7 -7
  24. {markdown_exec-1.12.2 → markdown_exec-1.12.3}/src/markdown_exec/_internal/debug.py +1 -1
  25. {markdown_exec-1.12.2 → markdown_exec-1.12.3}/src/markdown_exec/_internal/formatters/_exec_python.py +2 -2
  26. {markdown_exec-1.12.2 → markdown_exec-1.12.3}/src/markdown_exec/_internal/formatters/base.py +4 -3
  27. {markdown_exec-1.12.2 → markdown_exec-1.12.3}/src/markdown_exec/_internal/formatters/pyodide.py +3 -3
  28. {markdown_exec-1.12.2 → markdown_exec-1.12.3}/src/markdown_exec/_internal/formatters/python.py +2 -2
  29. {markdown_exec-1.12.2 → markdown_exec-1.12.3}/src/markdown_exec/_internal/formatters/tree.py +12 -4
  30. {markdown_exec-1.12.2 → markdown_exec-1.12.3}/src/markdown_exec/_internal/logger.py +4 -1
  31. {markdown_exec-1.12.2 → markdown_exec-1.12.3}/src/markdown_exec/_internal/mkdocs_plugin.py +2 -2
  32. {markdown_exec-1.12.2 → markdown_exec-1.12.3}/src/markdown_exec/_internal/processors.py +1 -1
  33. {markdown_exec-1.12.2 → markdown_exec-1.12.3}/src/markdown_exec/_internal/rendering.py +13 -13
  34. {markdown_exec-1.12.2 → markdown_exec-1.12.3}/tests/test_api.py +8 -7
  35. {markdown_exec-1.12.2 → markdown_exec-1.12.3}/tests/test_toc.py +6 -6
  36. markdown_exec-1.12.3/zensical.toml +199 -0
  37. markdown_exec-1.12.2/config/mypy.ini +0 -9
  38. markdown_exec-1.12.2/docs/.overrides/partials/path-item.html +0 -22
  39. markdown_exec-1.12.2/docs/css/material.css +0 -4
  40. markdown_exec-1.12.2/docs/css/mkdocstrings.css +0 -72
  41. markdown_exec-1.12.2/docs/snippets/gallery/pydeps.py +0 -43
  42. markdown_exec-1.12.2/mkdocs.yml +0 -187
  43. {markdown_exec-1.12.2 → markdown_exec-1.12.3}/CODE_OF_CONDUCT.md +0 -0
  44. {markdown_exec-1.12.2 → markdown_exec-1.12.3}/config/coverage.ini +0 -0
  45. {markdown_exec-1.12.2 → markdown_exec-1.12.3}/config/git-changelog.toml +0 -0
  46. {markdown_exec-1.12.2 → markdown_exec-1.12.3}/config/pytest.ini +0 -0
  47. {markdown_exec-1.12.2 → markdown_exec-1.12.3}/config/vscode/tasks.json +0 -0
  48. {markdown_exec-1.12.2 → markdown_exec-1.12.3}/docs/.overrides/main.html +0 -0
  49. {markdown_exec-1.12.2 → markdown_exec-1.12.3}/docs/changelog.md +0 -0
  50. {markdown_exec-1.12.2 → markdown_exec-1.12.3}/docs/code_of_conduct.md +0 -0
  51. {markdown_exec-1.12.2 → markdown_exec-1.12.3}/docs/contributing.md +0 -0
  52. {markdown_exec-1.12.2 → markdown_exec-1.12.3}/docs/credits.md +0 -0
  53. {markdown_exec-1.12.2 → markdown_exec-1.12.3}/docs/index.md +0 -0
  54. {markdown_exec-1.12.2 → markdown_exec-1.12.3}/docs/js/feedback.js +0 -0
  55. {markdown_exec-1.12.2 → markdown_exec-1.12.3}/docs/license.md +0 -0
  56. {markdown_exec-1.12.2 → markdown_exec-1.12.3}/docs/reference/api.md +0 -0
  57. {markdown_exec-1.12.2 → markdown_exec-1.12.3}/docs/schema.json +0 -0
  58. {markdown_exec-1.12.2 → markdown_exec-1.12.3}/docs/snippets/gallery/ansi.sh +0 -0
  59. {markdown_exec-1.12.2 → markdown_exec-1.12.3}/docs/snippets/gallery/argparse.py +0 -0
  60. {markdown_exec-1.12.2 → markdown_exec-1.12.3}/docs/snippets/gallery/argparse_format.py +0 -0
  61. {markdown_exec-1.12.2 → markdown_exec-1.12.3}/docs/snippets/gallery/chalk.py +0 -0
  62. {markdown_exec-1.12.2 → markdown_exec-1.12.3}/docs/snippets/gallery/d2.py +0 -0
  63. {markdown_exec-1.12.2 → markdown_exec-1.12.3}/docs/snippets/gallery/diagrams.py +0 -0
  64. {markdown_exec-1.12.2 → markdown_exec-1.12.3}/docs/snippets/gallery/drawsvg.py +0 -0
  65. {markdown_exec-1.12.2 → markdown_exec-1.12.3}/docs/snippets/gallery/expandable_filetree.py +0 -0
  66. {markdown_exec-1.12.2 → markdown_exec-1.12.3}/docs/snippets/gallery/hyperbolic.py +0 -0
  67. {markdown_exec-1.12.2 → markdown_exec-1.12.3}/docs/snippets/gallery/plotly.py +0 -0
  68. {markdown_exec-1.12.2 → markdown_exec-1.12.3}/docs/snippets/gallery/qrcode.py +0 -0
  69. {markdown_exec-1.12.2 → markdown_exec-1.12.3}/docs/snippets/gallery/rich.py +0 -0
  70. {markdown_exec-1.12.2 → markdown_exec-1.12.3}/docs/snippets/gallery/rich_terminal.py +0 -0
  71. {markdown_exec-1.12.2 → markdown_exec-1.12.3}/docs/snippets/gallery/runpy.py +0 -0
  72. {markdown_exec-1.12.2 → markdown_exec-1.12.3}/docs/snippets/gallery/textual.py +0 -0
  73. {markdown_exec-1.12.2 → markdown_exec-1.12.3}/docs/snippets/usage/boolean_matrix.py +0 -0
  74. {markdown_exec-1.12.2 → markdown_exec-1.12.3}/docs/snippets/usage/hide.py +0 -0
  75. {markdown_exec-1.12.2 → markdown_exec-1.12.3}/docs/snippets/usage/multiple.pycon +0 -0
  76. {markdown_exec-1.12.2 → markdown_exec-1.12.3}/docs/snippets/usage/platform_html.py +0 -0
  77. {markdown_exec-1.12.2 → markdown_exec-1.12.3}/docs/snippets/usage/platform_md.py +0 -0
  78. {markdown_exec-1.12.2 → markdown_exec-1.12.3}/docs/snippets/usage/source.py +0 -0
  79. {markdown_exec-1.12.2 → markdown_exec-1.12.3}/docs/snippets/usage/source.pycon +0 -0
  80. {markdown_exec-1.12.2 → markdown_exec-1.12.3}/docs/usage/python.md +0 -0
  81. {markdown_exec-1.12.2 → markdown_exec-1.12.3}/scripts/get_version.py +0 -0
  82. {markdown_exec-1.12.2 → markdown_exec-1.12.3}/scripts/make +0 -0
  83. {markdown_exec-1.12.2 → markdown_exec-1.12.3}/src/markdown_exec/__init__.py +0 -0
  84. {markdown_exec-1.12.2 → markdown_exec-1.12.3}/src/markdown_exec/_internal/__init__.py +0 -0
  85. {markdown_exec-1.12.2 → markdown_exec-1.12.3}/src/markdown_exec/_internal/formatters/__init__.py +0 -0
  86. {markdown_exec-1.12.2 → markdown_exec-1.12.3}/src/markdown_exec/_internal/formatters/bash.py +0 -0
  87. {markdown_exec-1.12.2 → markdown_exec-1.12.3}/src/markdown_exec/_internal/formatters/console.py +0 -0
  88. {markdown_exec-1.12.2 → markdown_exec-1.12.3}/src/markdown_exec/_internal/formatters/markdown.py +0 -0
  89. {markdown_exec-1.12.2 → markdown_exec-1.12.3}/src/markdown_exec/_internal/formatters/pycon.py +0 -0
  90. {markdown_exec-1.12.2 → markdown_exec-1.12.3}/src/markdown_exec/_internal/formatters/sh.py +0 -0
  91. {markdown_exec-1.12.2 → markdown_exec-1.12.3}/src/markdown_exec/_internal/main.py +0 -0
  92. {markdown_exec-1.12.2 → markdown_exec-1.12.3}/src/markdown_exec/assets/ansi.css +0 -0
  93. {markdown_exec-1.12.2 → markdown_exec-1.12.3}/src/markdown_exec/assets/pyodide.css +0 -0
  94. {markdown_exec-1.12.2 → markdown_exec-1.12.3}/src/markdown_exec/assets/pyodide.js +0 -0
  95. {markdown_exec-1.12.2 → markdown_exec-1.12.3}/src/markdown_exec/formatters/__init__.py +0 -0
  96. {markdown_exec-1.12.2 → markdown_exec-1.12.3}/src/markdown_exec/formatters/base.py +0 -0
  97. {markdown_exec-1.12.2 → markdown_exec-1.12.3}/src/markdown_exec/formatters/bash.py +0 -0
  98. {markdown_exec-1.12.2 → markdown_exec-1.12.3}/src/markdown_exec/formatters/console.py +0 -0
  99. {markdown_exec-1.12.2 → markdown_exec-1.12.3}/src/markdown_exec/formatters/markdown.py +0 -0
  100. {markdown_exec-1.12.2 → markdown_exec-1.12.3}/src/markdown_exec/formatters/pycon.py +0 -0
  101. {markdown_exec-1.12.2 → markdown_exec-1.12.3}/src/markdown_exec/formatters/pyodide.py +0 -0
  102. {markdown_exec-1.12.2 → markdown_exec-1.12.3}/src/markdown_exec/formatters/python.py +0 -0
  103. {markdown_exec-1.12.2 → markdown_exec-1.12.3}/src/markdown_exec/formatters/sh.py +0 -0
  104. {markdown_exec-1.12.2 → markdown_exec-1.12.3}/src/markdown_exec/formatters/tree.py +0 -0
  105. {markdown_exec-1.12.2 → markdown_exec-1.12.3}/src/markdown_exec/logger.py +0 -0
  106. {markdown_exec-1.12.2 → markdown_exec-1.12.3}/src/markdown_exec/mkdocs_plugin.py +0 -0
  107. {markdown_exec-1.12.2 → markdown_exec-1.12.3}/src/markdown_exec/processors.py +0 -0
  108. {markdown_exec-1.12.2 → markdown_exec-1.12.3}/src/markdown_exec/py.typed +0 -0
  109. {markdown_exec-1.12.2 → markdown_exec-1.12.3}/src/markdown_exec/rendering.py +0 -0
  110. {markdown_exec-1.12.2 → markdown_exec-1.12.3}/tests/__init__.py +0 -0
  111. {markdown_exec-1.12.2 → markdown_exec-1.12.3}/tests/conftest.py +0 -0
  112. {markdown_exec-1.12.2 → markdown_exec-1.12.3}/tests/test_base_formatter.py +0 -0
  113. {markdown_exec-1.12.2 → markdown_exec-1.12.3}/tests/test_converter.py +0 -0
  114. {markdown_exec-1.12.2 → markdown_exec-1.12.3}/tests/test_headings.py +0 -0
  115. {markdown_exec-1.12.2 → markdown_exec-1.12.3}/tests/test_python.py +0 -0
  116. {markdown_exec-1.12.2 → markdown_exec-1.12.3}/tests/test_shell.py +0 -0
  117. {markdown_exec-1.12.2 → markdown_exec-1.12.3}/tests/test_tree.py +0 -0
  118. {markdown_exec-1.12.2 → markdown_exec-1.12.3}/tests/test_validator.py +0 -0
@@ -0,0 +1,15 @@
1
+ # AI Contribution Policy
2
+
3
+ We accept AI-*assisted* contributions, both for code and documentation, with the following expectations:
4
+
5
+ - AI-assisted contributions must disclaim their use of AI.
6
+ - Contributors must fully understand the proposed changes and be able to explain why they are the correct approach.
7
+ - Issues must be created before creating pull requests (unless there is already a relevant issue).
8
+ - Issue and pull request templates must be followed.
9
+ - Comments (including bodies) in issues and pull requests must be written by humans. If you use LLMs to translate from one language to another, please include your original comment and the translated one.
10
+ - Git commits must be authored by humans, not AI/bot accounts or identities.
11
+ - Git commit messages must be written by humans, in English. If you cannot write English, please state so in the pull request body and we will write the commit messages ourselves.
12
+
13
+ Failure to comply with any of these requirements will result in issues or pull requests being closed immediately without comment. Repeated violations of this policy will result in a ban of the offending accounts/identities from contributing to this project and any related project from the same author/organization.
14
+
15
+ We do not accept AI-generated content in community spaces we maintain or moderate, such as GitHub discussions or Matrix rooms.
@@ -5,6 +5,19 @@ 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.3](https://github.com/pawamoy/markdown-exec/releases/tag/1.12.3) - 2026-07-07
9
+
10
+ <small>[Compare with 1.12.2](https://github.com/pawamoy/markdown-exec/compare/1.12.2...1.12.3)</small>
11
+
12
+ ### Bug Fixes
13
+
14
+ - Provide Pyodide options to Zensical ([abcb044](https://github.com/pawamoy/markdown-exec/commit/abcb0443751d4871968d20bddf66b0b4a9d45620) by Timothée Mazzucotelli). [Issue-100](https://github.com/pawamoy/markdown-exec/issues/100)
15
+
16
+ ### Code Refactoring
17
+
18
+ - Rename material-block source display option to block ([2cefa97](https://github.com/pawamoy/markdown-exec/commit/2cefa97a3ee918cf009afda0fa881286c92626b9) by Timothée Mazzucotelli).
19
+ - Update Pyodide hardcoded version to 314.0.2 ([eef2661](https://github.com/pawamoy/markdown-exec/commit/eef2661d878f9e13cbd3d923edba21037e478c41) by Timothée Mazzucotelli).
20
+
8
21
  ## [1.12.2](https://github.com/pawamoy/markdown-exec/releases/tag/1.12.2) - 2026-07-05
9
22
 
10
23
  <small>[Compare with 1.12.1](https://github.com/pawamoy/markdown-exec/compare/1.12.1...1.12.2)</small>
@@ -1,36 +1,26 @@
1
1
  # Contributing
2
2
 
3
- Contributions are welcome, and they are greatly appreciated! Every little bit helps, and credit will always be given.
3
+ Contributions are welcome, and they are greatly appreciated. Every little bit helps, and credit will always be given.
4
4
 
5
- ## Environment setup
5
+ **Please always create an issue before working on a new feature or a bug fix, so that we can discuss the implementation and make sure that your work will be merged.**
6
6
 
7
- Nothing easier!
7
+ ## Environment setup
8
8
 
9
- Fork and clone the repository, then:
9
+ Install [uv](https://github.com/astral-sh/uv) and [direnv](https://direnv.net/), fork and clone the repository, then:
10
10
 
11
11
  ```bash
12
12
  cd markdown-exec
13
+ direnv allow
13
14
  make setup
14
15
  ```
15
16
 
16
- > NOTE: If it fails for some reason, you'll need to install [uv](https://github.com/astral-sh/uv) manually.
17
- >
18
- > You can install it with:
19
- >
20
- > ```bash
21
- > curl -LsSf https://astral.sh/uv/install.sh | sh
22
- > ```
23
- >
24
- > Now you can try running `make setup` again, or simply `uv sync`.
25
-
26
17
  You now have the dependencies installed.
27
18
 
28
19
  Run `make help` to see all the available actions!
29
20
 
30
21
  ## Tasks
31
22
 
32
- The entry-point to run commands and tasks is the `make` Python script, located in the `scripts` directory. Try running `make` to show the available commands and tasks. The *commands* do not need the Python dependencies to be installed,
33
- while the *tasks* do. The cross-platform tasks are written in Python, thanks to [duty](https://github.com/pawamoy/duty).
23
+ The entry-point to run commands and tasks is the `make` Python script, located in the `scripts` directory. Try running `make` to show the available commands and tasks. The *commands* do not need the Python dependencies to be installed, while the *tasks* do. The cross-platform tasks are written in Python, thanks to [duty](https://github.com/pawamoy/duty).
34
24
 
35
25
  If you work in VSCode, we provide [an action to configure VSCode](https://pawamoy.github.io/copier-uv/work/#vscode-setup) for the project.
36
26
 
@@ -1,6 +1,6 @@
1
1
  ISC License
2
2
 
3
- Copyright (c) 2022, Timothée Mazzucotelli
3
+ Copyright (c) 2022, Timothée Mazzucotelli and contributors
4
4
 
5
5
  Permission to use, copy, modify, and/or distribute this software for any
6
6
  purpose with or without fee is hereby granted, provided that the above
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: markdown-exec
3
- Version: 1.12.2
3
+ Version: 1.12.3
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>
@@ -37,15 +37,14 @@ Description-Content-Type: text/markdown
37
37
  # Markdown Exec
38
38
 
39
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/)
40
+ [![documentation](https://img.shields.io/badge/docs-zensical-FF9100.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
42
  [![gitter](https://img.shields.io/badge/matrix-chat-4DB798.svg?style=flat)](https://app.gitter.im/#/room/#markdown-exec:gitter.im)
43
43
  [![radicle](https://img.shields.io/badge/rad-clone-6666FF.svg?style=flat)](https://app.radicle.at/nodes/seed.radicle.at/rad:z77aiLJkzYXtuNpZuvizfGkDuZbQ)
44
44
 
45
45
  Utilities to execute code blocks in Markdown files.
46
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.
47
+ For example, you write a Python code block that computes some HTML, and this HTML is injected in place of the code block.
49
48
 
50
49
  ## Installation
51
50
 
@@ -118,13 +117,19 @@ markdown_extensions:
118
117
  - pymdownx.superfences
119
118
  ```
120
119
 
120
+ ...or in Zensical configuration file, as a legacy plugin:
121
+
122
+ ```toml
123
+ [project.plugins.markdown-exec]
124
+ ```
125
+
121
126
  TIP: We recommend enabling Markdown Exec with the MkDocs plugin
122
- if you are using MkDocs: it will take care of adding relevant
127
+ if you are using MkDocs/Zensical: it will take care of adding relevant
123
128
  assets (CSS/JS) to the final site when needed.
124
129
 
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.
130
+ WARNING: **Limitation of configuration through Markdown/PyMDown for MkDocs.**
131
+ Configuration through `pymdownx.superfences` directly is not well supported within MkDocs for fences that require assets inclusion, like `pyodide`.
132
+ For these you will have to include the assets manually. In the future we will provide ways to include them automatically. In Zensical these assets are provided natively.
128
133
 
129
134
  ## Usage
130
135
 
@@ -1,15 +1,14 @@
1
1
  # Markdown Exec
2
2
 
3
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/)
4
+ [![documentation](https://img.shields.io/badge/docs-zensical-FF9100.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
6
  [![gitter](https://img.shields.io/badge/matrix-chat-4DB798.svg?style=flat)](https://app.gitter.im/#/room/#markdown-exec:gitter.im)
7
7
  [![radicle](https://img.shields.io/badge/rad-clone-6666FF.svg?style=flat)](https://app.radicle.at/nodes/seed.radicle.at/rad:z77aiLJkzYXtuNpZuvizfGkDuZbQ)
8
8
 
9
9
  Utilities to execute code blocks in Markdown files.
10
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.
11
+ For example, you write a Python code block that computes some HTML, and this HTML is injected in place of the code block.
13
12
 
14
13
  ## Installation
15
14
 
@@ -82,13 +81,19 @@ markdown_extensions:
82
81
  - pymdownx.superfences
83
82
  ```
84
83
 
84
+ ...or in Zensical configuration file, as a legacy plugin:
85
+
86
+ ```toml
87
+ [project.plugins.markdown-exec]
88
+ ```
89
+
85
90
  TIP: We recommend enabling Markdown Exec with the MkDocs plugin
86
- if you are using MkDocs: it will take care of adding relevant
91
+ if you are using MkDocs/Zensical: it will take care of adding relevant
87
92
  assets (CSS/JS) to the final site when needed.
88
93
 
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.
94
+ WARNING: **Limitation of configuration through Markdown/PyMDown for MkDocs.**
95
+ Configuration through `pymdownx.superfences` directly is not well supported within MkDocs for fences that require assets inclusion, like `pyodide`.
96
+ For these you will have to include the assets manually. In the future we will provide ways to include them automatically. In Zensical these assets are provided natively.
92
97
 
93
98
  ## Usage
94
99
 
@@ -1,34 +1,14 @@
1
- target-version = "py39"
1
+ target-version = "py310"
2
2
  line-length = 120
3
+ output-format = "concise"
3
4
 
4
5
  [lint]
5
6
  exclude = [
6
7
  "tests/fixtures/*.py",
7
8
  ]
8
- select = [
9
- "A", "ANN", "ARG",
10
- "B", "BLE",
11
- "C", "C4",
12
- "COM",
13
- "D", "DTZ",
14
- "E", "ERA", "EXE",
15
- "F", "FBT",
16
- "G",
17
- "I", "ICN", "INP", "ISC",
18
- "N",
19
- "PGH", "PIE", "PL", "PLC", "PLE", "PLR", "PLW", "PT", "PYI",
20
- "Q",
21
- "RUF", "RSE", "RET",
22
- "S", "SIM", "SLF",
23
- "T", "T10", "T20", "TCH", "TID", "TRY",
24
- "UP",
25
- "W",
26
- "YTT",
27
- ]
9
+ select = ["ALL"]
28
10
  ignore = [
29
11
  "A001", # Variable is shadowing a Python builtin
30
- "ANN101", # Missing type annotation for self
31
- "ANN102", # Missing type annotation for cls
32
12
  "ANN204", # Missing return type annotation for special method __str__
33
13
  "ANN401", # Dynamically typed expressions (typing.Any) are disallowed
34
14
  "ARG005", # Unused lambda argument
@@ -36,13 +16,18 @@ ignore = [
36
16
  "D105", # Missing docstring in magic method
37
17
  "D417", # Missing argument description in the docstring
38
18
  "E501", # Line too long
19
+ "EM101", # String literal when raising exception
20
+ "EM102", # f-string when raising exception
39
21
  "ERA001", # Commented out code
22
+ "FIX", # TODO, FIXME, etc.
40
23
  "G004", # Logging statement uses f-string
41
24
  "PLR0911", # Too many return statements
42
25
  "PLR0912", # Too many branches
43
26
  "PLR0913", # Too many arguments to function call
44
27
  "PLR0915", # Too many statements
45
- "SLF001", # Private member accessed
28
+ "SLF001", # Private member accessed
29
+ "TD002", # Missing author in TODO
30
+ "TD003", # Missing issue link for TODO
46
31
  "TRY003", # Avoid specifying long messages outside the exception class
47
32
  ]
48
33
 
@@ -0,0 +1,6 @@
1
+ [src]
2
+ exclude = ["tests/fixtures"]
3
+
4
+ [terminal]
5
+ error-on-warning = true
6
+ output-format = "concise"
@@ -23,11 +23,10 @@
23
23
  "name": "docs",
24
24
  "type": "debugpy",
25
25
  "request": "launch",
26
- "module": "mkdocs",
26
+ "module": "zensical",
27
27
  "justMyCode": false,
28
28
  "args": [
29
29
  "serve",
30
- "-v"
31
30
  ]
32
31
  },
33
32
  {
@@ -4,9 +4,6 @@
4
4
  "**/.venvs*/**": true,
5
5
  "**/venv*/**": true
6
6
  },
7
- "mypy-type-checker.args": [
8
- "--config-file=config/mypy.ini"
9
- ],
10
7
  "python.testing.unittestEnabled": false,
11
8
  "python.testing.pytestEnabled": true,
12
9
  "python.testing.pytestArgs": [
@@ -19,6 +16,7 @@
19
16
  "ruff.lint.args": [
20
17
  "--config=config/ruff.toml"
21
18
  ],
19
+ "ty.configurationFile": "config/ty.toml",
22
20
  "yaml.schemas": {
23
21
  "https://squidfunk.github.io/mkdocs-material/schema.json": "mkdocs.yml"
24
22
  },
@@ -1,5 +1,5 @@
1
1
  <!-- Giscus -->
2
- <!-- https://squidfunk.github.io/mkdocs-material/setup/adding-a-comment-system/#giscus-integration -->
2
+ <!-- https://zensical.org/docs/setup/comment-system/#giscus-integration -->
3
3
  <div id="feedback" style="display: none;">
4
4
  <h2 id="__comments">Feedback</h2>
5
5
  <script src="https://giscus.app/client.js"
@@ -0,0 +1,21 @@
1
+ /* Mark external links as such. */
2
+ a.external::after,
3
+ a.autorefs-external::after {
4
+ /* https://primer.style/octicons/arrow-up-right-24 */
5
+ mask-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M18.25 15.5a.75.75 0 00.75-.75v-9a.75.75 0 00-.75-.75h-9a.75.75 0 000 1.5h7.19L6.22 16.72a.75.75 0 101.06 1.06L17.5 7.56v7.19c0 .414.336.75.75.75z"></path></svg>');
6
+ -webkit-mask-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M18.25 15.5a.75.75 0 00.75-.75v-9a.75.75 0 00-.75-.75h-9a.75.75 0 000 1.5h7.19L6.22 16.72a.75.75 0 101.06 1.06L17.5 7.56v7.19c0 .414.336.75.75.75z"></path></svg>');
7
+ content: ' ';
8
+
9
+ display: inline-block;
10
+ vertical-align: middle;
11
+ position: relative;
12
+
13
+ height: 1em;
14
+ width: 1em;
15
+ background-color: currentColor;
16
+ }
17
+
18
+ a.external:hover::after,
19
+ a.autorefs-external:hover::after {
20
+ background-color: var(--md-accent-fg-color);
21
+ }
@@ -14,7 +14,7 @@ Welcome to our gallery of examples!
14
14
  > Diagram as Code for prototyping cloud system architectures.
15
15
 
16
16
  ````md exec="1" source="tabbed-right"
17
- ```python exec="true" html="true"
17
+ ```python exec="true" html="true" id="diagrams"
18
18
  --8<-- "gallery/diagrams.py"
19
19
  ```
20
20
  ````
@@ -24,7 +24,7 @@ Welcome to our gallery of examples!
24
24
  > A modern diagram scripting language that turns text to diagrams.
25
25
 
26
26
  ````md exec="1" source="tabbed-right"
27
- ```python exec="true" html="true"
27
+ ```python exec="true" html="true" id="d2"
28
28
  --8<-- "gallery/d2.py"
29
29
  ```
30
30
  ````
@@ -34,7 +34,7 @@ Welcome to our gallery of examples!
34
34
  > Matplotlib is a comprehensive library for creating static, animated, and interactive visualizations in Python.
35
35
 
36
36
  ````md exec="1" source="tabbed-right"
37
- ```python exec="1" html="1"
37
+ ```python exec="1" html="1" id="matplotlib"
38
38
  --8<-- "gallery/matplotlib.py"
39
39
  ```
40
40
  ````
@@ -46,7 +46,7 @@ Welcome to our gallery of examples!
46
46
  We call `pipdeptree` with its `--mermaid` option to generate a [Mermaid](https://mermaid.js.org/) diagram.
47
47
 
48
48
  ````md exec="1" source="tabbed-right"
49
- ```bash exec="1" result="mermaid"
49
+ ```bash exec="1" result="mermaid" id="pipdeptree1"
50
50
  # Change the direction of the graph from top-down to left-right,
51
51
  # and remove local version identifiers from our own package.
52
52
  pipdeptree -p markdown-exec --mermaid 2>/dev/null |
@@ -57,7 +57,7 @@ pipdeptree -p markdown-exec --mermaid 2>/dev/null |
57
57
  Another example with more dependencies:
58
58
 
59
59
  ````md exec="1" source="tabbed-right"
60
- ```bash exec="1" result="mermaid"
60
+ ```bash exec="1" result="mermaid" id="pipdeptree2"
61
61
  pipdeptree -p mkdocstrings-python --mermaid 2>/dev/null |
62
62
  sed 's/flowchart TD/flowchart LR/'
63
63
  ```
@@ -68,7 +68,7 @@ pipdeptree -p mkdocstrings-python --mermaid 2>/dev/null |
68
68
  > The interactive graphing library for Python ✨
69
69
 
70
70
  ````md exec="1" source="tabbed-right"
71
- ```python exec="true" html="true"
71
+ ```python exec="true" html="true" id="plotly"
72
72
  --8<-- "gallery/plotly.py"
73
73
  ```
74
74
  ````
@@ -80,7 +80,7 @@ pipdeptree -p mkdocstrings-python --mermaid 2>/dev/null |
80
80
  pydeps uses [Graphviz](https://graphviz.org/) under the hood to generate graphs. In this example we add links to the code reference in related nodes. Try clicking on the `markdown_exec` nodes!
81
81
 
82
82
  ````md exec="1" source="tabbed-right"
83
- ```python exec="true" html="true"
83
+ ```python exec="true" html="true" id="pydeps"
84
84
  --8<-- "gallery/pydeps.py"
85
85
  ```
86
86
  ````
@@ -92,7 +92,7 @@ pydeps uses [Graphviz](https://graphviz.org/) under the hood to generate graphs.
92
92
  > Rich is a Python library for rich text and beautiful formatting in the terminal.
93
93
 
94
94
  ````md exec="1" source="tabbed-right"
95
- ```python exec="true" html="true"
95
+ ```python exec="true" html="true" id="rich"
96
96
  --8<-- "gallery/rich.py"
97
97
  ```
98
98
  ````
@@ -102,7 +102,7 @@ pydeps uses [Graphviz](https://graphviz.org/) under the hood to generate graphs.
102
102
  If you installed Markdown Exec with the `ansi` extra (`pip install markdown-exec[ansi]`), the ANSI colors in the output of shell commands will be translated to HTML/CSS, allowing to render them naturally in your documentation pages. For this to happen, use the [`result="ansi"` option](http://localhost:8000/markdown-exec/usage/#wrap-result-in-a-code-block).
103
103
 
104
104
  ````md exec="1" source="tabbed-right"
105
- ```bash exec="true" result="ansi"
105
+ ```bash exec="true" result="ansi" id="ansi"
106
106
  --8<-- "gallery/ansi.sh"
107
107
  ```
108
108
  ````
@@ -112,7 +112,7 @@ If you installed Markdown Exec with the `ansi` extra (`pip install markdown-exec
112
112
  > Rich is a Python library for rich text and beautiful formatting in the terminal.
113
113
 
114
114
  ````md exec="1" source="tabbed-right"
115
- ```python exec="true" html="true"
115
+ ```python exec="true" html="true" id="richterminal"
116
116
  --8<-- "gallery/rich_terminal.py"
117
117
  ```
118
118
  ````
@@ -124,7 +124,7 @@ If you installed Markdown Exec with the `ansi` extra (`pip install markdown-exec
124
124
  > A declarative drawing API in Python.
125
125
 
126
126
  ````md exec="1" source="tabbed-right"
127
- ```python exec="true" html="true"
127
+ ```python exec="true" html="true" id="chalk"
128
128
  --8<-- "gallery/chalk.py"
129
129
  ```
130
130
  ````
@@ -133,7 +133,7 @@ If you installed Markdown Exec with the `ansi` extra (`pip install markdown-exec
133
133
  > Programmatically generate SVG (vector) images, animations, and interactive Jupyter widgets.
134
134
 
135
135
  ````md exec="1" source="tabbed-right"
136
- ```python exec="true" html="true"
136
+ ```python exec="true" html="true" id="drawsvg2"
137
137
  --8<-- "gallery/drawsvg.py"
138
138
  ```
139
139
  ````
@@ -143,7 +143,7 @@ If you installed Markdown Exec with the `ansi` extra (`pip install markdown-exec
143
143
  > A Python 3 library for constructing and drawing hyperbolic geometry.
144
144
 
145
145
  ````md exec="1" source="tabbed-right"
146
- ```python exec="true" html="true"
146
+ ```python exec="true" html="true" id="hyperbolic"
147
147
  --8<-- "gallery/hyperbolic.py"
148
148
  ```
149
149
  ````
@@ -155,7 +155,7 @@ If you installed Markdown Exec with the `ansi` extra (`pip install markdown-exec
155
155
  > Python QR Code image generator.
156
156
 
157
157
  ````md exec="1" source="tabbed-right"
158
- ```python exec="true" html="true"
158
+ ```python exec="true" html="true" id="qrcode"
159
159
  --8<-- "gallery/qrcode.py"
160
160
  ```
161
161
  ````
@@ -167,21 +167,21 @@ If you installed Markdown Exec with the `ansi` extra (`pip install markdown-exec
167
167
  > Textual is a *Rapid Application Development* framework for Python, built by [Textualize.io](https://www.textualize.io/).
168
168
 
169
169
  ````md exec="1" source="tabbed-right"
170
- ```python exec="1" html="true"
170
+ ```python exec="1" html="true" id="textual"
171
171
  --8<-- "gallery/textual.py"
172
172
  ```
173
173
  ````
174
174
 
175
175
  ## File-trees
176
176
 
177
- 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 🤯:
177
+ 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) (and [Zensical's](https://zensical.org/docs/authoring/code-blocks/#code-annotations)). It uses a recursive Python function which accept a code block session name as parameter 🤯:
178
178
 
179
179
  ````md exec="1" source="tabbed-right"
180
- ```python exec="1" session="filetree"
180
+ ```python exec="1" session="filetree" id="filetree-def"
181
181
  --8<-- "gallery/expandable_filetree.py"
182
182
  ```
183
183
 
184
- ```python exec="1" session="filetree"
184
+ ```python exec="1" session="filetree" id="filetree-run"
185
185
  exptree(".", "filetree")
186
186
  ```
187
187
  ````
@@ -1,4 +1,5 @@
1
1
  # https://matplotlib.org/stable/gallery/lines_bars_and_markers/scatter_demo2.html
2
+ import warnings
2
3
  from io import StringIO
3
4
 
4
5
  import matplotlib.cbook as cbook
@@ -17,9 +18,11 @@ delta1 = np.diff(price_data["adj_close"]) / price_data["adj_close"][:-1]
17
18
  volume = (15 * price_data["volume"][:-2] / price_data["volume"][0])**2
18
19
  close = 0.003 * price_data["close"][:-2] / 0.003 * price_data["open"][:-2]
19
20
 
20
- fig, ax = plt.subplots()
21
- ax.scatter(delta1[:-1], delta1[1:], c=close, s=volume, alpha=0.5)
21
+ with warnings.catch_warnings():
22
+ warnings.simplefilter("ignore")
23
+ fig, ax = plt.subplots()
22
24
 
25
+ ax.scatter(delta1[:-1], delta1[1:], c=close, s=volume, alpha=0.5)
23
26
  ax.set_xlabel(r"$\Delta_i$", fontsize=15)
24
27
  ax.set_ylabel(r"$\Delta_{i+1}$", fontsize=15)
25
28
  ax.set_title("Volume and percent change")
@@ -0,0 +1,19 @@
1
+ from pydeps import cli, colors, dot, py2depgraph
2
+ from pydeps.pydeps import depgraph_to_dotsrc
3
+ from pydeps.target import Target
4
+
5
+ # Note: pydeps wasn't designed to be used in such a programatic way, so the code is a bit convoluted,
6
+ # but you could make a function of it, put it in an importable script/module,
7
+ # and reuse it cleanly in your executed code blocks.
8
+
9
+ cli.verbose = cli._not_verbose
10
+ options = cli.parse_args(["src/markdown_exec", "--noshow"])
11
+ colors.START_COLOR = options["start_color"]
12
+ target = Target(options["fname"])
13
+ with target.chdir_work():
14
+ dep_graph = py2depgraph.py2dep(target, **options)
15
+ dot_src = depgraph_to_dotsrc(target, dep_graph, **options)
16
+ svg = dot.call_graphviz_dot(dot_src, "svg").decode()
17
+ svg = "".join(svg.splitlines()[6:])
18
+ svg = svg.replace('fill="white"', 'fill="transparent"')
19
+ print(svg)
@@ -38,7 +38,7 @@ linking to their related documentation:
38
38
  - [`tabs`](#change-the-titles-of-tabs): When rendering the source using tabs, choose the tabs titles.
39
39
  - [`width`](#change-the-console-width): Change the console width through the `COLUMNS` environment variable.
40
40
  - [`workdir`](#change-the-working-directory): Change the working directory.
41
- - [`title`](#additional-options): Title is a [Material for MkDocs][material] option.
41
+ - [`title`](#additional-options): Title is a [Material for MkDocs][material] / [Zensical] option.
42
42
  - [`updatetoc`](#generated-headings-in-table-of-contents): Whether to update the Table of Contents with generated headings.
43
43
 
44
44
  ## HTML vs. Markdown
@@ -98,7 +98,7 @@ with the `idprefix` option.
98
98
 
99
99
  The following ids are not prefixed:
100
100
 
101
- ````md exec="1" source="material-block"
101
+ ````md exec="1" source="block"
102
102
  ```python exec="1" idprefix="" updatetoc="no"
103
103
  print("#### Commands")
104
104
  print("\n[link to commands](#commands)")
@@ -107,7 +107,7 @@ print("\n[link to commands](#commands)")
107
107
 
108
108
  The following ids are prefixed with `cli-`:
109
109
 
110
- ````md exec="1" source="material-block"
110
+ ````md exec="1" source="block"
111
111
  ```python exec="1" idprefix="cli-" updatetoc="no"
112
112
  print("#### Commands")
113
113
  print("\n[link to commands](#commands)")
@@ -119,7 +119,7 @@ then the id is used as prefix:
119
119
 
120
120
  The following ids are prefixed with `super-cli-`:
121
121
 
122
- ````md exec="1" source="material-block"
122
+ ````md exec="1" source="block"
123
123
  ```python exec="1" id="super-cli" updatetoc="no"
124
124
  print("#### Commands")
125
125
  print("\n[link to commands](#commands)")
@@ -134,8 +134,8 @@ with one of the following values:
134
134
 
135
135
  - `above`: The source code will be rendered above the result.
136
136
  - `below`: The source code will be rendered below the result.
137
- - `material-block`: The source code and result will be wrapped in a nice-looking block
138
- (only works with [Material for MkDocs][material],
137
+ - `block`: The source code and result will be wrapped in a nice-looking block
138
+ (only works with [Material for MkDocs][material] or [Zensical],
139
139
  and requires the [`md_in_html`][md_in_html] extension)
140
140
  - `tabbed-left`: The source code and result will be rendered in tabs, in that order
141
141
  (requires the [`pymdownx.tabbed`][pymdownx.tabbed] extension).
@@ -163,16 +163,16 @@ with one of the following values:
163
163
 
164
164
  ---
165
165
 
166
- **Material block:**
166
+ **Block:**
167
167
 
168
168
  ````md exec="1" source="tabbed-left" tabs="Markdown|Rendered"
169
- ```python exec="true" source="material-block"
169
+ ```python exec="true" source="block"
170
170
  --8<-- "usage/source.py"
171
171
  ```
172
172
  ````
173
173
 
174
174
  NOTE: **Important:**
175
- The `material-block` source option requires that you enable the [`md_in_html`][md_in_html] Markdown extension.
175
+ The `block` source option requires that you enable the [`md_in_html`][md_in_html] Markdown extension.
176
176
 
177
177
  ---
178
178
 
@@ -317,7 +317,7 @@ pwd
317
317
 
318
318
  ## Additional options
319
319
 
320
- If you are using [Material for MkDocs][material],
320
+ If you are using [Material for MkDocs][material] or [Zensical],
321
321
  you are probably familiar with the `title` option on code blocks:
322
322
 
323
323
  ````md
@@ -390,7 +390,7 @@ WARNING - markdown_exec: Execution of python code block 'print hello' exited w
390
390
 
391
391
  > TIP: **Titles act as IDs as well!**
392
392
  > You *don't need* to provide an ID
393
- > if you already set a (Material for MkDocs) title:
393
+ > if you already set a (Material for MkDocs / Zensical) title:
394
394
  >
395
395
  > ````md
396
396
  > ```python exec="true" title="print world"
@@ -408,7 +408,7 @@ WARNING - markdown_exec: Execution of python code block 'print hello' exited w
408
408
  Markdown Exec makes it possible to persist state between executed code blocks.
409
409
  To persist state and reuse it in other code blocks, give a session name to your blocks:
410
410
 
411
- ````md exec="1" source="material-block" title="Sessions"
411
+ ````md exec="1" source="block" title="Sessions"
412
412
  ```python exec="1" session="greet"
413
413
  def greet(name):
414
414
  print(f"Hello {name}!")
@@ -438,7 +438,7 @@ We effectively support executing multiple *nested* code blocks to generate compl
438
438
  That makes for a very meta-markdown markup:
439
439
 
440
440
  ````md exec="1" source="tabbed-left"
441
- ```md exec="1" source="material-block" title="Markdown link"
441
+ ```md exec="1" source="block" title="Markdown link"
442
442
  [Link to example.com](https://example.com)
443
443
  ```
444
444
  ````
@@ -448,7 +448,7 @@ That makes for a very meta-markdown markup:
448
448
  >
449
449
  > `````md
450
450
  > ````md exec="1" source="tabbed-left"
451
- > ```md exec="1" source="material-block" title="Markdown link"
451
+ > ```md exec="1" source="block" title="Markdown link"
452
452
  > [Link to example.com](https://example.com)
453
453
  > ```
454
454
  > ````
@@ -478,18 +478,8 @@ to the MkDocs configuration file directory, instead of relative to the current
478
478
  working directory. This will make it possible to use the `-f` option of MkDocs,
479
479
  to build the documentation from a different directory than the repository root.
480
480
 
481
- Example:
482
-
483
- ```python exec="1" source="material-block"
484
- import os
485
-
486
- config_dir = os.environ['MKDOCS_CONFIG_DIR']
487
-
488
- # This will show my local path since I deploy docs from my machine:
489
- print(f"Configuration file directory: `{config_dir}`")
490
- ```
491
-
492
481
  The environment variable will be restored to its previous value, if any,
493
482
  at the end of the build.
494
483
 
495
- [material]: https://squidfunk.github.io/mkdocs-material/
484
+ [material]: https://squidfunk.github.io/mkdocs-material/
485
+ [Zensical]: https://zensical.org/