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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (121) hide show
  1. {markdown_exec-1.13.0 → markdown_exec-1.14.0}/CHANGELOG.md +8 -0
  2. {markdown_exec-1.13.0 → markdown_exec-1.14.0}/PKG-INFO +1 -1
  3. markdown_exec-1.14.0/docs/usage/octave.md +10 -0
  4. {markdown_exec-1.13.0 → markdown_exec-1.14.0}/pyproject.toml +1 -1
  5. markdown_exec-1.14.0/src/markdown_exec/_internal/formatters/octave.py +52 -0
  6. {markdown_exec-1.13.0 → markdown_exec-1.14.0}/src/markdown_exec/_internal/main.py +2 -0
  7. markdown_exec-1.14.0/tests/test_octave.py +130 -0
  8. {markdown_exec-1.13.0 → markdown_exec-1.14.0}/zensical.toml +1 -0
  9. {markdown_exec-1.13.0 → markdown_exec-1.14.0}/AI_POLICY.md +0 -0
  10. {markdown_exec-1.13.0 → markdown_exec-1.14.0}/CODE_OF_CONDUCT.md +0 -0
  11. {markdown_exec-1.13.0 → markdown_exec-1.14.0}/CONTRIBUTING.md +0 -0
  12. {markdown_exec-1.13.0 → markdown_exec-1.14.0}/LICENSE +0 -0
  13. {markdown_exec-1.13.0 → markdown_exec-1.14.0}/README.md +0 -0
  14. {markdown_exec-1.13.0 → markdown_exec-1.14.0}/config/coverage.ini +0 -0
  15. {markdown_exec-1.13.0 → markdown_exec-1.14.0}/config/git-changelog.toml +0 -0
  16. {markdown_exec-1.13.0 → markdown_exec-1.14.0}/config/pytest.ini +0 -0
  17. {markdown_exec-1.13.0 → markdown_exec-1.14.0}/config/ruff.toml +0 -0
  18. {markdown_exec-1.13.0 → markdown_exec-1.14.0}/config/ty.toml +0 -0
  19. {markdown_exec-1.13.0 → markdown_exec-1.14.0}/config/vscode/launch.json +0 -0
  20. {markdown_exec-1.13.0 → markdown_exec-1.14.0}/config/vscode/settings.json +0 -0
  21. {markdown_exec-1.13.0 → markdown_exec-1.14.0}/config/vscode/tasks.json +0 -0
  22. {markdown_exec-1.13.0 → markdown_exec-1.14.0}/config/zed/debug.json +0 -0
  23. {markdown_exec-1.13.0 → markdown_exec-1.14.0}/config/zed/settings.json +0 -0
  24. {markdown_exec-1.13.0 → markdown_exec-1.14.0}/config/zed/tasks.json +0 -0
  25. {markdown_exec-1.13.0 → markdown_exec-1.14.0}/docs/.overrides/main.html +0 -0
  26. {markdown_exec-1.13.0 → markdown_exec-1.14.0}/docs/.overrides/partials/comments.html +0 -0
  27. {markdown_exec-1.13.0 → markdown_exec-1.14.0}/docs/changelog.md +0 -0
  28. {markdown_exec-1.13.0 → markdown_exec-1.14.0}/docs/code_of_conduct.md +0 -0
  29. {markdown_exec-1.13.0 → markdown_exec-1.14.0}/docs/contributing.md +0 -0
  30. {markdown_exec-1.13.0 → markdown_exec-1.14.0}/docs/credits.md +0 -0
  31. {markdown_exec-1.13.0 → markdown_exec-1.14.0}/docs/css/apidocs.css +0 -0
  32. {markdown_exec-1.13.0 → markdown_exec-1.14.0}/docs/gallery.md +0 -0
  33. {markdown_exec-1.13.0 → markdown_exec-1.14.0}/docs/index.md +0 -0
  34. {markdown_exec-1.13.0 → markdown_exec-1.14.0}/docs/js/feedback.js +0 -0
  35. {markdown_exec-1.13.0 → markdown_exec-1.14.0}/docs/license.md +0 -0
  36. {markdown_exec-1.13.0 → markdown_exec-1.14.0}/docs/reference/api.md +0 -0
  37. {markdown_exec-1.13.0 → markdown_exec-1.14.0}/docs/schema.json +0 -0
  38. {markdown_exec-1.13.0 → markdown_exec-1.14.0}/docs/snippets/gallery/ansi.sh +0 -0
  39. {markdown_exec-1.13.0 → markdown_exec-1.14.0}/docs/snippets/gallery/argparse.py +0 -0
  40. {markdown_exec-1.13.0 → markdown_exec-1.14.0}/docs/snippets/gallery/argparse_format.py +0 -0
  41. {markdown_exec-1.13.0 → markdown_exec-1.14.0}/docs/snippets/gallery/chalk.py +0 -0
  42. {markdown_exec-1.13.0 → markdown_exec-1.14.0}/docs/snippets/gallery/d2.py +0 -0
  43. {markdown_exec-1.13.0 → markdown_exec-1.14.0}/docs/snippets/gallery/diagrams.py +0 -0
  44. {markdown_exec-1.13.0 → markdown_exec-1.14.0}/docs/snippets/gallery/drawsvg.py +0 -0
  45. {markdown_exec-1.13.0 → markdown_exec-1.14.0}/docs/snippets/gallery/expandable_filetree.py +0 -0
  46. {markdown_exec-1.13.0 → markdown_exec-1.14.0}/docs/snippets/gallery/highcharts.py +0 -0
  47. {markdown_exec-1.13.0 → markdown_exec-1.14.0}/docs/snippets/gallery/hyperbolic.py +0 -0
  48. {markdown_exec-1.13.0 → markdown_exec-1.14.0}/docs/snippets/gallery/matplotlib.py +0 -0
  49. {markdown_exec-1.13.0 → markdown_exec-1.14.0}/docs/snippets/gallery/plotly.py +0 -0
  50. {markdown_exec-1.13.0 → markdown_exec-1.14.0}/docs/snippets/gallery/pydeps.py +0 -0
  51. {markdown_exec-1.13.0 → markdown_exec-1.14.0}/docs/snippets/gallery/qrcode.py +0 -0
  52. {markdown_exec-1.13.0 → markdown_exec-1.14.0}/docs/snippets/gallery/rich.py +0 -0
  53. {markdown_exec-1.13.0 → markdown_exec-1.14.0}/docs/snippets/gallery/rich_terminal.py +0 -0
  54. {markdown_exec-1.13.0 → markdown_exec-1.14.0}/docs/snippets/gallery/runpy.py +0 -0
  55. {markdown_exec-1.13.0 → markdown_exec-1.14.0}/docs/snippets/gallery/textual.py +0 -0
  56. {markdown_exec-1.13.0 → markdown_exec-1.14.0}/docs/snippets/gallery/vega.py +0 -0
  57. {markdown_exec-1.13.0 → markdown_exec-1.14.0}/docs/snippets/usage/boolean_matrix.py +0 -0
  58. {markdown_exec-1.13.0 → markdown_exec-1.14.0}/docs/snippets/usage/hide.py +0 -0
  59. {markdown_exec-1.13.0 → markdown_exec-1.14.0}/docs/snippets/usage/interactive.pycon +0 -0
  60. {markdown_exec-1.13.0 → markdown_exec-1.14.0}/docs/snippets/usage/multiple.pycon +0 -0
  61. {markdown_exec-1.13.0 → markdown_exec-1.14.0}/docs/snippets/usage/platform_html.py +0 -0
  62. {markdown_exec-1.13.0 → markdown_exec-1.14.0}/docs/snippets/usage/platform_md.py +0 -0
  63. {markdown_exec-1.13.0 → markdown_exec-1.14.0}/docs/snippets/usage/source.py +0 -0
  64. {markdown_exec-1.13.0 → markdown_exec-1.14.0}/docs/snippets/usage/source.pycon +0 -0
  65. {markdown_exec-1.13.0 → markdown_exec-1.14.0}/docs/usage/index.md +0 -0
  66. {markdown_exec-1.13.0 → markdown_exec-1.14.0}/docs/usage/pyodide.md +0 -0
  67. {markdown_exec-1.13.0 → markdown_exec-1.14.0}/docs/usage/python.md +0 -0
  68. {markdown_exec-1.13.0 → markdown_exec-1.14.0}/docs/usage/shell.md +0 -0
  69. {markdown_exec-1.13.0 → markdown_exec-1.14.0}/docs/usage/tree.md +0 -0
  70. {markdown_exec-1.13.0 → markdown_exec-1.14.0}/duties.py +0 -0
  71. {markdown_exec-1.13.0 → markdown_exec-1.14.0}/scripts/gen_credits.py +0 -0
  72. {markdown_exec-1.13.0 → markdown_exec-1.14.0}/scripts/get_version.py +0 -0
  73. {markdown_exec-1.13.0 → markdown_exec-1.14.0}/scripts/make +0 -0
  74. {markdown_exec-1.13.0 → markdown_exec-1.14.0}/scripts/make.py +0 -0
  75. {markdown_exec-1.13.0 → markdown_exec-1.14.0}/src/markdown_exec/__init__.py +0 -0
  76. {markdown_exec-1.13.0 → markdown_exec-1.14.0}/src/markdown_exec/_internal/__init__.py +0 -0
  77. {markdown_exec-1.13.0 → markdown_exec-1.14.0}/src/markdown_exec/_internal/debug.py +0 -0
  78. {markdown_exec-1.13.0 → markdown_exec-1.14.0}/src/markdown_exec/_internal/formatters/__init__.py +0 -0
  79. {markdown_exec-1.13.0 → markdown_exec-1.14.0}/src/markdown_exec/_internal/formatters/_exec_python.py +0 -0
  80. {markdown_exec-1.13.0 → markdown_exec-1.14.0}/src/markdown_exec/_internal/formatters/base.py +0 -0
  81. {markdown_exec-1.13.0 → markdown_exec-1.14.0}/src/markdown_exec/_internal/formatters/bash.py +0 -0
  82. {markdown_exec-1.13.0 → markdown_exec-1.14.0}/src/markdown_exec/_internal/formatters/console.py +0 -0
  83. {markdown_exec-1.13.0 → markdown_exec-1.14.0}/src/markdown_exec/_internal/formatters/markdown.py +0 -0
  84. {markdown_exec-1.13.0 → markdown_exec-1.14.0}/src/markdown_exec/_internal/formatters/pycon.py +0 -0
  85. {markdown_exec-1.13.0 → markdown_exec-1.14.0}/src/markdown_exec/_internal/formatters/pyodide.py +0 -0
  86. {markdown_exec-1.13.0 → markdown_exec-1.14.0}/src/markdown_exec/_internal/formatters/python.py +0 -0
  87. {markdown_exec-1.13.0 → markdown_exec-1.14.0}/src/markdown_exec/_internal/formatters/sh.py +0 -0
  88. {markdown_exec-1.13.0 → markdown_exec-1.14.0}/src/markdown_exec/_internal/formatters/tree.py +0 -0
  89. {markdown_exec-1.13.0 → markdown_exec-1.14.0}/src/markdown_exec/_internal/logger.py +0 -0
  90. {markdown_exec-1.13.0 → markdown_exec-1.14.0}/src/markdown_exec/_internal/mkdocs_plugin.py +0 -0
  91. {markdown_exec-1.13.0 → markdown_exec-1.14.0}/src/markdown_exec/_internal/processors.py +0 -0
  92. {markdown_exec-1.13.0 → markdown_exec-1.14.0}/src/markdown_exec/_internal/rendering.py +0 -0
  93. {markdown_exec-1.13.0 → markdown_exec-1.14.0}/src/markdown_exec/assets/ansi.css +0 -0
  94. {markdown_exec-1.13.0 → markdown_exec-1.14.0}/src/markdown_exec/assets/pyodide.css +0 -0
  95. {markdown_exec-1.13.0 → markdown_exec-1.14.0}/src/markdown_exec/assets/pyodide.js +0 -0
  96. {markdown_exec-1.13.0 → markdown_exec-1.14.0}/src/markdown_exec/formatters/__init__.py +0 -0
  97. {markdown_exec-1.13.0 → markdown_exec-1.14.0}/src/markdown_exec/formatters/base.py +0 -0
  98. {markdown_exec-1.13.0 → markdown_exec-1.14.0}/src/markdown_exec/formatters/bash.py +0 -0
  99. {markdown_exec-1.13.0 → markdown_exec-1.14.0}/src/markdown_exec/formatters/console.py +0 -0
  100. {markdown_exec-1.13.0 → markdown_exec-1.14.0}/src/markdown_exec/formatters/markdown.py +0 -0
  101. {markdown_exec-1.13.0 → markdown_exec-1.14.0}/src/markdown_exec/formatters/pycon.py +0 -0
  102. {markdown_exec-1.13.0 → markdown_exec-1.14.0}/src/markdown_exec/formatters/pyodide.py +0 -0
  103. {markdown_exec-1.13.0 → markdown_exec-1.14.0}/src/markdown_exec/formatters/python.py +0 -0
  104. {markdown_exec-1.13.0 → markdown_exec-1.14.0}/src/markdown_exec/formatters/sh.py +0 -0
  105. {markdown_exec-1.13.0 → markdown_exec-1.14.0}/src/markdown_exec/formatters/tree.py +0 -0
  106. {markdown_exec-1.13.0 → markdown_exec-1.14.0}/src/markdown_exec/logger.py +0 -0
  107. {markdown_exec-1.13.0 → markdown_exec-1.14.0}/src/markdown_exec/mkdocs_plugin.py +0 -0
  108. {markdown_exec-1.13.0 → markdown_exec-1.14.0}/src/markdown_exec/processors.py +0 -0
  109. {markdown_exec-1.13.0 → markdown_exec-1.14.0}/src/markdown_exec/py.typed +0 -0
  110. {markdown_exec-1.13.0 → markdown_exec-1.14.0}/src/markdown_exec/rendering.py +0 -0
  111. {markdown_exec-1.13.0 → markdown_exec-1.14.0}/tests/__init__.py +0 -0
  112. {markdown_exec-1.13.0 → markdown_exec-1.14.0}/tests/conftest.py +0 -0
  113. {markdown_exec-1.13.0 → markdown_exec-1.14.0}/tests/test_api.py +0 -0
  114. {markdown_exec-1.13.0 → markdown_exec-1.14.0}/tests/test_base_formatter.py +0 -0
  115. {markdown_exec-1.13.0 → markdown_exec-1.14.0}/tests/test_converter.py +0 -0
  116. {markdown_exec-1.13.0 → markdown_exec-1.14.0}/tests/test_headings.py +0 -0
  117. {markdown_exec-1.13.0 → markdown_exec-1.14.0}/tests/test_python.py +0 -0
  118. {markdown_exec-1.13.0 → markdown_exec-1.14.0}/tests/test_shell.py +0 -0
  119. {markdown_exec-1.13.0 → markdown_exec-1.14.0}/tests/test_toc.py +0 -0
  120. {markdown_exec-1.13.0 → markdown_exec-1.14.0}/tests/test_tree.py +0 -0
  121. {markdown_exec-1.13.0 → markdown_exec-1.14.0}/tests/test_validator.py +0 -0
@@ -5,6 +5,14 @@ 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.14.0](https://github.com/pawamoy/markdown-exec/releases/tag/1.14.0) - 2026-11-19
9
+
10
+ <small>[Compare with 1.13.0](https://github.com/pawamoy/markdown-exec/compare/1.13.0...1.14.0)</small>
11
+
12
+ ### Features
13
+
14
+ - Support GNU Octave code blocks ([0007cd4](https://github.com/pawamoy/markdown-exec/commit/0007cd434a5efc9ccd786e5ea20ee9822e093a45) by MattG-K). [Issue-111](https://github.com/pawamoy/markdown-exec/issues/111), [PR-112](https://github.com/pawamoy/markdown-exec/pull/112), Co-authored-by: Matthieu Guerquin-Kern <matthieu.guerquin-kern@grenoble-inp.fr>
15
+
8
16
  ## [1.13.0](https://github.com/pawamoy/markdown-exec/releases/tag/1.13.0) - 2026-11-10
9
17
 
10
18
  <small>[Compare with 1.12.6](https://github.com/pawamoy/markdown-exec/compare/1.12.6...1.13.0)</small>
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: markdown-exec
3
- Version: 1.13.0
3
+ Version: 1.14.0
4
4
  Summary: Utilities to execute code blocks in Markdown files.
5
5
  Keywords: markdown,python,exec,shell,bash,mkdocs
6
6
  Author-Email: Timothée Mazzucotelli <dev@pawamoy.fr>
@@ -0,0 +1,10 @@
1
+ # GNU Octave
2
+
3
+ The `octave-cli` interpreter is called to execute the GNU Octave code blocks.
4
+ Uses `octave-cli -e`.
5
+
6
+ ````md exec="true" source="tabbed-left" tabs="Markdown|Rendered"
7
+ ```octave exec="true"
8
+ disp("**Hello world!**")
9
+ ```
10
+ ````
@@ -45,7 +45,7 @@ dependencies = [
45
45
  "markupsafe>=2",
46
46
  "pymdown-extensions>=9",
47
47
  ]
48
- version = "1.13.0"
48
+ version = "1.14.0"
49
49
 
50
50
  [project.optional-dependencies]
51
51
  ansi = [
@@ -0,0 +1,52 @@
1
+ # SPDX-License-Identifier: ISC
2
+ #
3
+ # ISC License
4
+ #
5
+ # Copyright (c) 2022, Timothée Mazzucotelli and contributors
6
+ #
7
+ # Permission to use, copy, modify, and/or distribute this software for any
8
+ # purpose with or without fee is hereby granted, provided that the above
9
+ # copyright notice and this permission notice appear in all copies.
10
+ #
11
+ # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12
+ # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13
+ # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14
+ # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15
+ # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16
+ # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17
+ # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18
+
19
+ # Formatter for executing Octave/Matlab code.
20
+
21
+ from __future__ import annotations
22
+
23
+ import subprocess
24
+ from typing import Any
25
+
26
+ from markdown_exec._internal.formatters.base import ExecutionError, base_format
27
+ from markdown_exec._internal.rendering import code_block
28
+
29
+
30
+ def _run_octave(
31
+ code: str,
32
+ returncode: int | None = None,
33
+ session: str | None = None, # noqa: ARG001
34
+ id: str | None = None, # noqa: A002,ARG001
35
+ **extra: str,
36
+ ) -> str:
37
+ # Disable history to prevent history-file errors from appearing in the output at exit.
38
+ process = subprocess.run( # noqa: S603
39
+ ["octave-cli", "--no-gui", "--quiet", "--no-history", "-e", code], # noqa: S607
40
+ stdout=subprocess.PIPE,
41
+ stderr=subprocess.STDOUT,
42
+ text=True,
43
+ check=False,
44
+ encoding="utf8",
45
+ )
46
+ if process.returncode != returncode:
47
+ raise ExecutionError(code_block("octave", process.stdout, **extra), process.returncode)
48
+ return process.stdout
49
+
50
+
51
+ def _format_octave(**kwargs: Any) -> str:
52
+ return base_format(language="octave", run=_run_octave, **kwargs)
@@ -26,6 +26,7 @@ from markdown_exec._internal.formatters.base import default_tabs
26
26
  from markdown_exec._internal.formatters.bash import _format_bash
27
27
  from markdown_exec._internal.formatters.console import _format_console
28
28
  from markdown_exec._internal.formatters.markdown import _format_markdown
29
+ from markdown_exec._internal.formatters.octave import _format_octave
29
30
  from markdown_exec._internal.formatters.pycon import _format_pycon
30
31
  from markdown_exec._internal.formatters.pyodide import _format_pyodide
31
32
  from markdown_exec._internal.formatters.python import _format_python
@@ -47,6 +48,7 @@ formatters = {
47
48
  "console": _format_console,
48
49
  "md": _format_markdown,
49
50
  "markdown": _format_markdown,
51
+ "octave": _format_octave,
50
52
  "py": _format_python,
51
53
  "python": _format_python,
52
54
  "pycon": _format_pycon,
@@ -0,0 +1,130 @@
1
+ # SPDX-License-Identifier: ISC
2
+ #
3
+ # ISC License
4
+ #
5
+ # Copyright (c) 2022, Timothée Mazzucotelli and contributors
6
+ #
7
+ # Permission to use, copy, modify, and/or distribute this software for any
8
+ # purpose with or without fee is hereby granted, provided that the above
9
+ # copyright notice and this permission notice appear in all copies.
10
+ #
11
+ # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12
+ # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13
+ # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14
+ # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15
+ # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16
+ # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17
+ # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18
+
19
+ """Tests for the octave formatter."""
20
+
21
+ from __future__ import annotations
22
+
23
+ from shutil import which
24
+ from textwrap import dedent
25
+ from typing import TYPE_CHECKING
26
+
27
+ import pytest
28
+
29
+ if TYPE_CHECKING:
30
+ from pathlib import Path
31
+
32
+ from markdown import Markdown
33
+
34
+
35
+ pytestmark = pytest.mark.skipif(which("octave-cli") is None, reason="octave-cli is not installed")
36
+
37
+
38
+ def test_output_markdown(md: Markdown) -> None:
39
+ """Assert Markdown is converted to HTML.
40
+
41
+ Parameters:
42
+ md: A Markdown instance (fixture).
43
+ """
44
+ html = md.convert(
45
+ dedent(
46
+ """
47
+ ```octave exec="yes"
48
+ disp("**Bold!**")
49
+ ```
50
+ """,
51
+ ),
52
+ )
53
+ assert html == "<p><strong>Bold!</strong></p>"
54
+
55
+
56
+ def test_output_html(md: Markdown) -> None:
57
+ """Assert HTML is injected as is.
58
+
59
+ Parameters:
60
+ md: A Markdown instance (fixture).
61
+ """
62
+ html = md.convert(
63
+ dedent(
64
+ """
65
+ ```octave exec="yes" html="yes"
66
+ disp("**Bold!**")
67
+ ```
68
+ """,
69
+ ),
70
+ )
71
+ assert html == "<p>**Bold!**\n</p>"
72
+
73
+
74
+ def test_output_with_invalid_history_file(md: Markdown, monkeypatch: pytest.MonkeyPatch, tmp_path: Path) -> None:
75
+ """Assert history-file errors do not appear in rendered output."""
76
+ # A directory cannot be used as a history file.
77
+ monkeypatch.setenv("OCTAVE_HISTFILE", str(tmp_path))
78
+
79
+ html = md.convert(
80
+ dedent(
81
+ """
82
+ ```octave exec="yes" html="yes"
83
+ disp("**Bold!**")
84
+ ```
85
+ """,
86
+ ),
87
+ )
88
+
89
+ assert html == "<p>**Bold!**\n</p>"
90
+
91
+
92
+ def test_error_raised(md: Markdown, caplog: pytest.LogCaptureFixture) -> None:
93
+ """Assert errors properly log a warning and return a formatted traceback.
94
+
95
+ Parameters:
96
+ md: A Markdown instance (fixture).
97
+ caplog: Pytest fixture to capture logs.
98
+ """
99
+ html = md.convert(
100
+ dedent(
101
+ """
102
+ ```octave exec="yes"
103
+ print("wrong syntax")
104
+ ```
105
+ """,
106
+ ),
107
+ )
108
+ assert "error" in html
109
+ assert "Execution of octave code block exited with unexpected code 1" in caplog.text
110
+
111
+
112
+ def test_return_code(md: Markdown, caplog: pytest.LogCaptureFixture) -> None:
113
+ """Assert return code is used correctly.
114
+
115
+ Parameters:
116
+ md: A Markdown instance (fixture).
117
+ caplog: Pytest fixture to capture logs.
118
+ """
119
+ html = md.convert(
120
+ dedent(
121
+ """
122
+ ```octave exec="yes" returncode="2"
123
+ disp('Not in the mood')
124
+ exit(2)
125
+ ```
126
+ """,
127
+ ),
128
+ )
129
+ assert "Not in the mood" in html
130
+ assert "exited with" not in caplog.text
@@ -21,6 +21,7 @@ nav = [
21
21
  { "Python" = "usage/python.md" },
22
22
  { "Pyodide" = "usage/pyodide.md" },
23
23
  { "Shell" = "usage/shell.md" },
24
+ { "Octave" = "usage/octave.md" },
24
25
  { "Tree" = "usage/tree.md" },
25
26
  ] },
26
27
  { "Gallery" = "gallery.md" },
File without changes
File without changes
File without changes