markdown-exec 1.10.3__tar.gz → 1.11.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.
- {markdown_exec-1.10.3 → markdown_exec-1.11.0}/CHANGELOG.md +16 -0
- {markdown_exec-1.10.3 → markdown_exec-1.11.0}/PKG-INFO +1 -1
- {markdown_exec-1.10.3 → markdown_exec-1.11.0}/docs/usage/pyodide.md +50 -0
- {markdown_exec-1.10.3 → markdown_exec-1.11.0}/duties.py +1 -1
- {markdown_exec-1.10.3 → markdown_exec-1.11.0}/mkdocs.yml +5 -4
- {markdown_exec-1.10.3 → markdown_exec-1.11.0}/pyproject.toml +3 -2
- {markdown_exec-1.10.3 → markdown_exec-1.11.0}/src/markdown_exec/__init__.py +11 -3
- {markdown_exec-1.10.3 → markdown_exec-1.11.0}/src/markdown_exec/_internal/formatters/pyodide.py +29 -1
- {markdown_exec-1.10.3 → markdown_exec-1.11.0}/src/markdown_exec/assets/pyodide.css +0 -2
- {markdown_exec-1.10.3 → markdown_exec-1.11.0}/src/markdown_exec/assets/pyodide.js +15 -1
- {markdown_exec-1.10.3 → markdown_exec-1.11.0}/CODE_OF_CONDUCT.md +0 -0
- {markdown_exec-1.10.3 → markdown_exec-1.11.0}/CONTRIBUTING.md +0 -0
- {markdown_exec-1.10.3 → markdown_exec-1.11.0}/LICENSE +0 -0
- {markdown_exec-1.10.3 → markdown_exec-1.11.0}/README.md +0 -0
- {markdown_exec-1.10.3 → markdown_exec-1.11.0}/config/coverage.ini +0 -0
- {markdown_exec-1.10.3 → markdown_exec-1.11.0}/config/git-changelog.toml +0 -0
- {markdown_exec-1.10.3 → markdown_exec-1.11.0}/config/mypy.ini +0 -0
- {markdown_exec-1.10.3 → markdown_exec-1.11.0}/config/pytest.ini +0 -0
- {markdown_exec-1.10.3 → markdown_exec-1.11.0}/config/ruff.toml +0 -0
- {markdown_exec-1.10.3 → markdown_exec-1.11.0}/config/vscode/launch.json +0 -0
- {markdown_exec-1.10.3 → markdown_exec-1.11.0}/config/vscode/settings.json +0 -0
- {markdown_exec-1.10.3 → markdown_exec-1.11.0}/config/vscode/tasks.json +0 -0
- {markdown_exec-1.10.3 → markdown_exec-1.11.0}/docs/.overrides/main.html +0 -0
- {markdown_exec-1.10.3 → markdown_exec-1.11.0}/docs/.overrides/partials/comments.html +0 -0
- {markdown_exec-1.10.3 → markdown_exec-1.11.0}/docs/.overrides/partials/path-item.html +0 -0
- {markdown_exec-1.10.3 → markdown_exec-1.11.0}/docs/changelog.md +0 -0
- {markdown_exec-1.10.3 → markdown_exec-1.11.0}/docs/code_of_conduct.md +0 -0
- {markdown_exec-1.10.3 → markdown_exec-1.11.0}/docs/contributing.md +0 -0
- {markdown_exec-1.10.3 → markdown_exec-1.11.0}/docs/credits.md +0 -0
- {markdown_exec-1.10.3 → markdown_exec-1.11.0}/docs/css/insiders.css +0 -0
- {markdown_exec-1.10.3 → markdown_exec-1.11.0}/docs/css/material.css +0 -0
- {markdown_exec-1.10.3 → markdown_exec-1.11.0}/docs/css/mkdocstrings.css +0 -0
- {markdown_exec-1.10.3 → markdown_exec-1.11.0}/docs/gallery.md +0 -0
- {markdown_exec-1.10.3 → markdown_exec-1.11.0}/docs/index.md +0 -0
- {markdown_exec-1.10.3 → markdown_exec-1.11.0}/docs/insiders/changelog.md +0 -0
- {markdown_exec-1.10.3 → markdown_exec-1.11.0}/docs/insiders/goals.yml +0 -0
- {markdown_exec-1.10.3 → markdown_exec-1.11.0}/docs/insiders/index.md +0 -0
- {markdown_exec-1.10.3 → markdown_exec-1.11.0}/docs/insiders/installation.md +0 -0
- {markdown_exec-1.10.3 → markdown_exec-1.11.0}/docs/js/feedback.js +0 -0
- {markdown_exec-1.10.3 → markdown_exec-1.11.0}/docs/js/insiders.js +0 -0
- {markdown_exec-1.10.3 → markdown_exec-1.11.0}/docs/license.md +0 -0
- {markdown_exec-1.10.3 → markdown_exec-1.11.0}/docs/reference/api.md +0 -0
- {markdown_exec-1.10.3 → markdown_exec-1.11.0}/docs/schema.json +0 -0
- {markdown_exec-1.10.3 → markdown_exec-1.11.0}/docs/snippets/gallery/ansi.sh +0 -0
- {markdown_exec-1.10.3 → markdown_exec-1.11.0}/docs/snippets/gallery/argparse.py +0 -0
- {markdown_exec-1.10.3 → markdown_exec-1.11.0}/docs/snippets/gallery/argparse_format.py +0 -0
- {markdown_exec-1.10.3 → markdown_exec-1.11.0}/docs/snippets/gallery/chalk.py +0 -0
- {markdown_exec-1.10.3 → markdown_exec-1.11.0}/docs/snippets/gallery/d2.py +0 -0
- {markdown_exec-1.10.3 → markdown_exec-1.11.0}/docs/snippets/gallery/diagrams.py +0 -0
- {markdown_exec-1.10.3 → markdown_exec-1.11.0}/docs/snippets/gallery/drawsvg.py +0 -0
- {markdown_exec-1.10.3 → markdown_exec-1.11.0}/docs/snippets/gallery/expandable_filetree.py +0 -0
- {markdown_exec-1.10.3 → markdown_exec-1.11.0}/docs/snippets/gallery/hyperbolic.py +0 -0
- {markdown_exec-1.10.3 → markdown_exec-1.11.0}/docs/snippets/gallery/matplotlib.py +0 -0
- {markdown_exec-1.10.3 → markdown_exec-1.11.0}/docs/snippets/gallery/plotly.py +0 -0
- {markdown_exec-1.10.3 → markdown_exec-1.11.0}/docs/snippets/gallery/pydeps.py +0 -0
- {markdown_exec-1.10.3 → markdown_exec-1.11.0}/docs/snippets/gallery/qrcode.py +0 -0
- {markdown_exec-1.10.3 → markdown_exec-1.11.0}/docs/snippets/gallery/rich.py +0 -0
- {markdown_exec-1.10.3 → markdown_exec-1.11.0}/docs/snippets/gallery/rich_terminal.py +0 -0
- {markdown_exec-1.10.3 → markdown_exec-1.11.0}/docs/snippets/gallery/runpy.py +0 -0
- {markdown_exec-1.10.3 → markdown_exec-1.11.0}/docs/snippets/gallery/textual.py +0 -0
- {markdown_exec-1.10.3 → markdown_exec-1.11.0}/docs/snippets/usage/boolean_matrix.py +0 -0
- {markdown_exec-1.10.3 → markdown_exec-1.11.0}/docs/snippets/usage/hide.py +0 -0
- {markdown_exec-1.10.3 → markdown_exec-1.11.0}/docs/snippets/usage/multiple.pycon +0 -0
- {markdown_exec-1.10.3 → markdown_exec-1.11.0}/docs/snippets/usage/platform_html.py +0 -0
- {markdown_exec-1.10.3 → markdown_exec-1.11.0}/docs/snippets/usage/platform_md.py +0 -0
- {markdown_exec-1.10.3 → markdown_exec-1.11.0}/docs/snippets/usage/source.py +0 -0
- {markdown_exec-1.10.3 → markdown_exec-1.11.0}/docs/snippets/usage/source.pycon +0 -0
- {markdown_exec-1.10.3 → markdown_exec-1.11.0}/docs/usage/index.md +0 -0
- {markdown_exec-1.10.3 → markdown_exec-1.11.0}/docs/usage/python.md +0 -0
- {markdown_exec-1.10.3 → markdown_exec-1.11.0}/docs/usage/shell.md +0 -0
- {markdown_exec-1.10.3 → markdown_exec-1.11.0}/docs/usage/tree.md +0 -0
- {markdown_exec-1.10.3 → markdown_exec-1.11.0}/scripts/gen_credits.py +0 -0
- {markdown_exec-1.10.3 → markdown_exec-1.11.0}/scripts/get_version.py +0 -0
- {markdown_exec-1.10.3 → markdown_exec-1.11.0}/scripts/insiders.py +0 -0
- {markdown_exec-1.10.3 → markdown_exec-1.11.0}/scripts/make +0 -0
- {markdown_exec-1.10.3 → markdown_exec-1.11.0}/scripts/make.py +0 -0
- {markdown_exec-1.10.3 → markdown_exec-1.11.0}/src/markdown_exec/_internal/__init__.py +0 -0
- {markdown_exec-1.10.3 → markdown_exec-1.11.0}/src/markdown_exec/_internal/debug.py +0 -0
- {markdown_exec-1.10.3 → markdown_exec-1.11.0}/src/markdown_exec/_internal/formatters/__init__.py +0 -0
- {markdown_exec-1.10.3 → markdown_exec-1.11.0}/src/markdown_exec/_internal/formatters/_exec_python.py +0 -0
- {markdown_exec-1.10.3 → markdown_exec-1.11.0}/src/markdown_exec/_internal/formatters/base.py +0 -0
- {markdown_exec-1.10.3 → markdown_exec-1.11.0}/src/markdown_exec/_internal/formatters/bash.py +0 -0
- {markdown_exec-1.10.3 → markdown_exec-1.11.0}/src/markdown_exec/_internal/formatters/console.py +0 -0
- {markdown_exec-1.10.3 → markdown_exec-1.11.0}/src/markdown_exec/_internal/formatters/markdown.py +0 -0
- {markdown_exec-1.10.3 → markdown_exec-1.11.0}/src/markdown_exec/_internal/formatters/pycon.py +0 -0
- {markdown_exec-1.10.3 → markdown_exec-1.11.0}/src/markdown_exec/_internal/formatters/python.py +0 -0
- {markdown_exec-1.10.3 → markdown_exec-1.11.0}/src/markdown_exec/_internal/formatters/sh.py +0 -0
- {markdown_exec-1.10.3 → markdown_exec-1.11.0}/src/markdown_exec/_internal/formatters/tree.py +0 -0
- {markdown_exec-1.10.3 → markdown_exec-1.11.0}/src/markdown_exec/_internal/logger.py +0 -0
- {markdown_exec-1.10.3 → markdown_exec-1.11.0}/src/markdown_exec/_internal/main.py +0 -0
- {markdown_exec-1.10.3 → markdown_exec-1.11.0}/src/markdown_exec/_internal/mkdocs_plugin.py +0 -0
- {markdown_exec-1.10.3 → markdown_exec-1.11.0}/src/markdown_exec/_internal/processors.py +0 -0
- {markdown_exec-1.10.3 → markdown_exec-1.11.0}/src/markdown_exec/_internal/rendering.py +0 -0
- {markdown_exec-1.10.3 → markdown_exec-1.11.0}/src/markdown_exec/assets/ansi.css +0 -0
- {markdown_exec-1.10.3 → markdown_exec-1.11.0}/src/markdown_exec/formatters/__init__.py +0 -0
- {markdown_exec-1.10.3 → markdown_exec-1.11.0}/src/markdown_exec/formatters/base.py +0 -0
- {markdown_exec-1.10.3 → markdown_exec-1.11.0}/src/markdown_exec/formatters/bash.py +0 -0
- {markdown_exec-1.10.3 → markdown_exec-1.11.0}/src/markdown_exec/formatters/console.py +0 -0
- {markdown_exec-1.10.3 → markdown_exec-1.11.0}/src/markdown_exec/formatters/markdown.py +0 -0
- {markdown_exec-1.10.3 → markdown_exec-1.11.0}/src/markdown_exec/formatters/pycon.py +0 -0
- {markdown_exec-1.10.3 → markdown_exec-1.11.0}/src/markdown_exec/formatters/pyodide.py +0 -0
- {markdown_exec-1.10.3 → markdown_exec-1.11.0}/src/markdown_exec/formatters/python.py +0 -0
- {markdown_exec-1.10.3 → markdown_exec-1.11.0}/src/markdown_exec/formatters/sh.py +0 -0
- {markdown_exec-1.10.3 → markdown_exec-1.11.0}/src/markdown_exec/formatters/tree.py +0 -0
- {markdown_exec-1.10.3 → markdown_exec-1.11.0}/src/markdown_exec/logger.py +0 -0
- {markdown_exec-1.10.3 → markdown_exec-1.11.0}/src/markdown_exec/mkdocs_plugin.py +0 -0
- {markdown_exec-1.10.3 → markdown_exec-1.11.0}/src/markdown_exec/processors.py +0 -0
- {markdown_exec-1.10.3 → markdown_exec-1.11.0}/src/markdown_exec/py.typed +0 -0
- {markdown_exec-1.10.3 → markdown_exec-1.11.0}/src/markdown_exec/rendering.py +0 -0
- {markdown_exec-1.10.3 → markdown_exec-1.11.0}/tests/__init__.py +0 -0
- {markdown_exec-1.10.3 → markdown_exec-1.11.0}/tests/conftest.py +0 -0
- {markdown_exec-1.10.3 → markdown_exec-1.11.0}/tests/test_api.py +0 -0
- {markdown_exec-1.10.3 → markdown_exec-1.11.0}/tests/test_base_formatter.py +0 -0
- {markdown_exec-1.10.3 → markdown_exec-1.11.0}/tests/test_converter.py +0 -0
- {markdown_exec-1.10.3 → markdown_exec-1.11.0}/tests/test_headings.py +0 -0
- {markdown_exec-1.10.3 → markdown_exec-1.11.0}/tests/test_python.py +0 -0
- {markdown_exec-1.10.3 → markdown_exec-1.11.0}/tests/test_shell.py +0 -0
- {markdown_exec-1.10.3 → markdown_exec-1.11.0}/tests/test_toc.py +0 -0
- {markdown_exec-1.10.3 → markdown_exec-1.11.0}/tests/test_tree.py +0 -0
- {markdown_exec-1.10.3 → markdown_exec-1.11.0}/tests/test_validator.py +0 -0
@@ -5,6 +5,22 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
|
5
5
|
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
6
6
|
|
7
7
|
<!-- insertion marker -->
|
8
|
+
## [1.11.0](https://github.com/pawamoy/markdown-exec/releases/tag/1.11.0) - 2025-06-28
|
9
|
+
|
10
|
+
<small>[Compare with 1.10.4](https://github.com/pawamoy/markdown-exec/compare/1.10.4...1.11.0)</small>
|
11
|
+
|
12
|
+
### Features
|
13
|
+
|
14
|
+
- Add option to set height of Pyodide/Ace editors ([c64a2ef](https://github.com/pawamoy/markdown-exec/commit/c64a2efd8cb7a7a691039e866dab5839f8ef8bfe) by Jayant Pranjal). [Issue-41](https://github.com/pawamoy/markdown-exec/issues/41), Co-authored-by: Jayant <jayant@Jayants-MacBook-Air.local>, Co-authored-by: Timothée Mazzucotelli <dev@pawamoy.fr>
|
15
|
+
|
16
|
+
## [1.10.4](https://github.com/pawamoy/markdown-exec/releases/tag/1.10.4) - 2025-06-27
|
17
|
+
|
18
|
+
<small>[Compare with 1.10.3](https://github.com/pawamoy/markdown-exec/compare/1.10.3...1.10.4)</small>
|
19
|
+
|
20
|
+
### Bug Fixes
|
21
|
+
|
22
|
+
- Don't fail when used as Markdown extension and MkDocs is not installed ([7722250](https://github.com/pawamoy/markdown-exec/commit/7722250931f44d2328af69cd20143035d3ba404e) by Timothée Mazzucotelli). [Issue-91](https://github.com/pawamoy/markdown-exec/discussions/91)
|
23
|
+
|
8
24
|
## [1.10.3](https://github.com/pawamoy/markdown-exec/releases/tag/1.10.3) - 2025-03-24
|
9
25
|
|
10
26
|
<small>[Compare with 1.10.2](https://github.com/pawamoy/markdown-exec/compare/1.10.2...1.10.3)</small>
|
@@ -45,6 +45,56 @@ print("Hello.")
|
|
45
45
|
|
46
46
|
NOTE: **All Pyodide blocks on the same page should use the same version!**
|
47
47
|
|
48
|
+
## Editor height
|
49
|
+
|
50
|
+
The height of the editor can be configured with the `height` option. It accepts the following values:
|
51
|
+
|
52
|
+
- `0` or `auto`: A fixed number of lines, based on initial code.
|
53
|
+
- a positive number, like `10`: A fixed number of lines.
|
54
|
+
- a positive range, like `5-30`: The minimum and maximum number of lines. The editor will shring/grow as you type.
|
55
|
+
|
56
|
+
The default is `auto`.
|
57
|
+
|
58
|
+
A few examples:
|
59
|
+
|
60
|
+
````md exec="1" source="tabbed-left" tabs="Markdown|Rendered" title="Fixed height (10 lines)"
|
61
|
+
```pyodide height="10"
|
62
|
+
from typing import Iterator
|
63
|
+
|
64
|
+
# This is an example
|
65
|
+
class Math:
|
66
|
+
@staticmethod
|
67
|
+
def fib(n: int) -> Iterator[int]:
|
68
|
+
"""Fibonacci series up to n."""
|
69
|
+
a, b = 0, 1
|
70
|
+
while a < n:
|
71
|
+
yield a
|
72
|
+
a, b = b, a + b
|
73
|
+
|
74
|
+
result = sum(Math.fib(42))
|
75
|
+
print(f"The answer is {result}")
|
76
|
+
```
|
77
|
+
````
|
78
|
+
|
79
|
+
````md exec="1" source="tabbed-left" tabs="Markdown|Rendered" title="Between 1 and 40 lines"
|
80
|
+
```pyodide height="1-40"
|
81
|
+
from typing import Iterator
|
82
|
+
|
83
|
+
# This is an example
|
84
|
+
class Math:
|
85
|
+
@staticmethod
|
86
|
+
def fib(n: int) -> Iterator[int]:
|
87
|
+
"""Fibonacci series up to n."""
|
88
|
+
a, b = 0, 1
|
89
|
+
while a < n:
|
90
|
+
yield a
|
91
|
+
a, b = b, a + b
|
92
|
+
|
93
|
+
result = sum(Math.fib(42))
|
94
|
+
print(f"The answer is {result}")
|
95
|
+
```
|
96
|
+
````
|
97
|
+
|
48
98
|
## Sessions
|
49
99
|
|
50
100
|
Editors with the same session share the same `globals()` dictionary,
|
@@ -237,7 +237,7 @@ def coverage(ctx: Context) -> None:
|
|
237
237
|
|
238
238
|
|
239
239
|
@duty
|
240
|
-
def test(ctx: Context, *cli_args: str, match: str = "") -> None:
|
240
|
+
def test(ctx: Context, *cli_args: str, match: str = "") -> None: # noqa: PT028
|
241
241
|
"""Run the test suite.
|
242
242
|
|
243
243
|
Parameters:
|
@@ -154,11 +154,12 @@ plugins:
|
|
154
154
|
signature_crossrefs: true
|
155
155
|
summary: true
|
156
156
|
- llmstxt:
|
157
|
-
|
158
|
-
|
159
|
-
|
157
|
+
full_output: llms-full.txt
|
158
|
+
sections:
|
159
|
+
Usage:
|
160
160
|
- index.md
|
161
|
-
|
161
|
+
API:
|
162
|
+
- reference/api.md
|
162
163
|
- git-revision-date-localized:
|
163
164
|
enabled: !ENV [DEPLOY, false]
|
164
165
|
enable_creation_date: true
|
@@ -45,7 +45,7 @@ classifiers = [
|
|
45
45
|
dependencies = [
|
46
46
|
"pymdown-extensions>=9",
|
47
47
|
]
|
48
|
-
version = "1.
|
48
|
+
version = "1.11.0"
|
49
49
|
|
50
50
|
[project.optional-dependencies]
|
51
51
|
ansi = [
|
@@ -72,6 +72,7 @@ getter = "scripts.get_version:get_version"
|
|
72
72
|
[tool.pdm.build]
|
73
73
|
excludes = [
|
74
74
|
"**/.pytest_cache",
|
75
|
+
"**/.mypy_cache",
|
75
76
|
]
|
76
77
|
source-includes = [
|
77
78
|
"config",
|
@@ -120,7 +121,7 @@ docs = [
|
|
120
121
|
"mkdocs>=1.6",
|
121
122
|
"mkdocs-coverage>=1.0",
|
122
123
|
"mkdocs-git-revision-date-localized-plugin>=1.2",
|
123
|
-
"mkdocs-llmstxt>=0.
|
124
|
+
"mkdocs-llmstxt>=0.2",
|
124
125
|
"mkdocs-material>=9.5",
|
125
126
|
"mkdocs-minify-plugin>=0.8",
|
126
127
|
"mkdocs-section-index>=0.3",
|
@@ -12,7 +12,6 @@ from markdown_exec._internal.formatters.base import (
|
|
12
12
|
)
|
13
13
|
from markdown_exec._internal.logger import get_logger, patch_loggers
|
14
14
|
from markdown_exec._internal.main import MARKDOWN_EXEC_AUTO, formatter, formatters, validator
|
15
|
-
from markdown_exec._internal.mkdocs_plugin import MarkdownExecPlugin, MarkdownExecPluginConfig
|
16
15
|
from markdown_exec._internal.processors import (
|
17
16
|
HeadingReportingTreeprocessor,
|
18
17
|
IdPrependingTreeprocessor,
|
@@ -36,8 +35,6 @@ __all__ = [
|
|
36
35
|
"InsertHeadings",
|
37
36
|
"MarkdownConfig",
|
38
37
|
"MarkdownConverter",
|
39
|
-
"MarkdownExecPlugin",
|
40
|
-
"MarkdownExecPluginConfig",
|
41
38
|
"RemoveHeadings",
|
42
39
|
"add_source",
|
43
40
|
"base_format",
|
@@ -53,3 +50,14 @@ __all__ = [
|
|
53
50
|
"validator",
|
54
51
|
"working_directory",
|
55
52
|
]
|
53
|
+
|
54
|
+
|
55
|
+
try:
|
56
|
+
from markdown_exec._internal.mkdocs_plugin import MarkdownExecPlugin, MarkdownExecPluginConfig
|
57
|
+
except ImportError:
|
58
|
+
pass
|
59
|
+
else:
|
60
|
+
__all__ += [
|
61
|
+
"MarkdownExecPlugin",
|
62
|
+
"MarkdownExecPluginConfig",
|
63
|
+
]
|
{markdown_exec-1.10.3 → markdown_exec-1.11.0}/src/markdown_exec/_internal/formatters/pyodide.py
RENAMED
@@ -37,7 +37,15 @@ _template = """
|
|
37
37
|
|
38
38
|
<script>
|
39
39
|
document.addEventListener('DOMContentLoaded', (event) => {
|
40
|
-
setupPyodide(
|
40
|
+
setupPyodide(
|
41
|
+
'%(id_prefix)s',
|
42
|
+
install=%(install)s,
|
43
|
+
themeLight='%(theme_light)s',
|
44
|
+
themeDark='%(theme_dark)s',
|
45
|
+
session='%(session)s',
|
46
|
+
minLines=%(min_lines)s,
|
47
|
+
maxLines=%(max_lines)s,
|
48
|
+
);
|
41
49
|
});
|
42
50
|
</script>
|
43
51
|
"""
|
@@ -45,9 +53,26 @@ document.addEventListener('DOMContentLoaded', (event) => {
|
|
45
53
|
_counter = 0
|
46
54
|
|
47
55
|
|
56
|
+
def _calculate_height(code: str, extra: dict) -> tuple[int, int]:
|
57
|
+
"""Calculate height configuration for the Pyodide editor."""
|
58
|
+
height = extra.pop("height", "auto")
|
59
|
+
|
60
|
+
if height in ("auto", "0"):
|
61
|
+
min_lines = max_lines = len(code.strip().splitlines()) if code.strip() else 5
|
62
|
+
elif "-" in height:
|
63
|
+
min_lines, max_lines = height.split("-")
|
64
|
+
min_lines = max(1, int(min_lines or "5"))
|
65
|
+
max_lines = max(min_lines, int(max_lines or "30"))
|
66
|
+
else:
|
67
|
+
min_lines = max_lines = int(height)
|
68
|
+
|
69
|
+
return min_lines, max_lines
|
70
|
+
|
71
|
+
|
48
72
|
def _format_pyodide(code: str, md: Markdown, session: str, extra: dict, **options: Any) -> str: # noqa: ARG001
|
49
73
|
global _counter # noqa: PLW0603
|
50
74
|
_counter += 1
|
75
|
+
|
51
76
|
version = extra.pop("version", "0.26.4").lstrip("v")
|
52
77
|
install = extra.pop("install", "")
|
53
78
|
install = install.split(",") if install else []
|
@@ -56,6 +81,7 @@ def _format_pyodide(code: str, md: Markdown, session: str, extra: dict, **option
|
|
56
81
|
if "," not in theme:
|
57
82
|
theme = f"{theme},{theme}"
|
58
83
|
theme_light, theme_dark = theme.split(",")
|
84
|
+
min_lines, max_lines = _calculate_height(code, extra)
|
59
85
|
|
60
86
|
data = {
|
61
87
|
"id_prefix": f"exec-{_counter}--",
|
@@ -66,6 +92,8 @@ def _format_pyodide(code: str, md: Markdown, session: str, extra: dict, **option
|
|
66
92
|
"session": session or "default",
|
67
93
|
"play_emoji": _play_emoji,
|
68
94
|
"clear_emoji": _clear_emoji,
|
95
|
+
"min_lines": min_lines,
|
96
|
+
"max_lines": max_lines,
|
69
97
|
}
|
70
98
|
rendered = _template % data
|
71
99
|
if exclude_assets:
|
@@ -77,7 +77,15 @@ function updateTheme(editor, light, dark) {
|
|
77
77
|
});
|
78
78
|
}
|
79
79
|
|
80
|
-
async function setupPyodide(
|
80
|
+
async function setupPyodide(
|
81
|
+
idPrefix,
|
82
|
+
install = null,
|
83
|
+
themeLight = 'tomorrow',
|
84
|
+
themeDark = 'tomorrow_night',
|
85
|
+
session = null,
|
86
|
+
minLines = 5,
|
87
|
+
maxLines = 30,
|
88
|
+
) {
|
81
89
|
const editor = ace.edit(idPrefix + "editor");
|
82
90
|
const run = document.getElementById(idPrefix + "run");
|
83
91
|
const clear = document.getElementById(idPrefix + "clear");
|
@@ -88,6 +96,12 @@ async function setupPyodide(idPrefix, install = null, themeLight = 'tomorrow', t
|
|
88
96
|
editor.session.setMode("ace/mode/python");
|
89
97
|
setTheme(editor, getTheme(), themeLight, themeDark);
|
90
98
|
|
99
|
+
editor.setOption("minLines", minLines);
|
100
|
+
editor.setOption("maxLines", maxLines);
|
101
|
+
|
102
|
+
// Force editor to resize after setting options
|
103
|
+
editor.resize();
|
104
|
+
|
91
105
|
writeOutput(output, "Initializing...");
|
92
106
|
let pyodide = await pyodidePromise;
|
93
107
|
if (install && install.length) {
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{markdown_exec-1.10.3 → markdown_exec-1.11.0}/src/markdown_exec/_internal/formatters/__init__.py
RENAMED
File without changes
|
{markdown_exec-1.10.3 → markdown_exec-1.11.0}/src/markdown_exec/_internal/formatters/_exec_python.py
RENAMED
File without changes
|
{markdown_exec-1.10.3 → markdown_exec-1.11.0}/src/markdown_exec/_internal/formatters/base.py
RENAMED
File without changes
|
{markdown_exec-1.10.3 → markdown_exec-1.11.0}/src/markdown_exec/_internal/formatters/bash.py
RENAMED
File without changes
|
{markdown_exec-1.10.3 → markdown_exec-1.11.0}/src/markdown_exec/_internal/formatters/console.py
RENAMED
File without changes
|
{markdown_exec-1.10.3 → markdown_exec-1.11.0}/src/markdown_exec/_internal/formatters/markdown.py
RENAMED
File without changes
|
{markdown_exec-1.10.3 → markdown_exec-1.11.0}/src/markdown_exec/_internal/formatters/pycon.py
RENAMED
File without changes
|
{markdown_exec-1.10.3 → markdown_exec-1.11.0}/src/markdown_exec/_internal/formatters/python.py
RENAMED
File without changes
|
File without changes
|
{markdown_exec-1.10.3 → markdown_exec-1.11.0}/src/markdown_exec/_internal/formatters/tree.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|