File tree Expand file tree Collapse file tree 4 files changed +17
-11
lines changed
src/markdown_exec/_internal Expand file tree Collapse file tree 4 files changed +17
-11
lines changed Original file line number Diff line number Diff line change 32
32
- name : Set up Graphviz
33
33
uses : ts-graphviz/setup-graphviz@v1
34
34
35
+ - name : Setup D2
36
+ run : curl -fsSL https://d2lang.com/install.sh | sh -s --
37
+
35
38
- name : Setup Python
36
39
uses : actions/setup-python@v5
37
40
with :
47
50
run : make setup
48
51
49
52
- name : Check if the documentation builds correctly
53
+ env :
54
+ GH_TOKEN : ${{ github.token }}
50
55
run : make check-docs
51
56
52
57
- name : Check the code quality
Original file line number Diff line number Diff line change 1
- import os # markdown-exec: hide
2
- if "CI" in os .environ : # markdown-exec: hide
3
- print ("D2 is not installed in CI, skipping this gallery example." ) # markdown-exec: hide
4
- raise SystemExit (0 ) # markdown-exec: hide
5
1
import subprocess
6
2
7
3
diagram = """
Original file line number Diff line number Diff line change 6
6
7
7
old_argv = list (sys .argv )
8
8
sys .argv = ["mkdocs" ]
9
- old_stdout = sys .stdout
10
- sys .stdout = StringIO ()
9
+ old_stderr = sys .stderr
10
+ sys .stderr = StringIO ()
11
11
warnings .filterwarnings ("ignore" , category = RuntimeWarning )
12
12
with suppress (SystemExit ):
13
13
run_module ("mkdocs" , run_name = "__main__" )
14
- output = sys .stdout .getvalue ()
15
- sys .stdout = old_stdout
14
+ output = sys .stderr .getvalue ()
15
+ sys .stderr = old_stderr
16
16
sys .argv = old_argv
17
17
18
18
print (f"```\n { output } \n ```" )
Original file line number Diff line number Diff line change 4
4
import re
5
5
from typing import TYPE_CHECKING , Any
6
6
7
- if TYPE_CHECKING :
8
- from markdown import Markdown
9
-
10
7
from markdown_exec ._internal .formatters .base import default_tabs
11
8
from markdown_exec ._internal .formatters .bash import _format_bash
12
9
from markdown_exec ._internal .formatters .console import _format_console
16
13
from markdown_exec ._internal .formatters .python import _format_python
17
14
from markdown_exec ._internal .formatters .sh import _format_sh
18
15
from markdown_exec ._internal .formatters .tree import _format_tree
16
+ from markdown_exec ._internal .logger import get_logger
17
+
18
+ if TYPE_CHECKING :
19
+ from markdown import Markdown
19
20
20
21
MARKDOWN_EXEC_AUTO = [lang .strip () for lang in os .getenv ("MARKDOWN_EXEC_AUTO" , "" ).split ("," )]
21
22
"""Languages to automatically execute."""
22
23
24
+
25
+ _logger = get_logger ("markdown-exec" )
26
+
23
27
formatters = {
24
28
"bash" : _format_bash ,
25
29
"console" : _format_console ,
@@ -116,6 +120,7 @@ def formatter(
116
120
HTML contents.
117
121
"""
118
122
fmt = formatters .get (language , lambda source , ** kwargs : source )
123
+ _logger .debug ("Executing %s code block with options: %s" , language , options )
119
124
return fmt (code = source , md = md , ** options ) # type: ignore[operator]
120
125
121
126
You can’t perform that action at this time.
0 commit comments