diff --git a/docs/gallery.md b/docs/gallery.md index 4be4fce..a70a0e0 100644 --- a/docs/gallery.md +++ b/docs/gallery.md @@ -19,9 +19,11 @@ as base64 encoded PNG data. Finally we output an HTML image with the base64 data Using SVG is not possible here since Diagrams embeds actual, smaller PNG files in the result, files which are not automatically added to the final site. -```python exec="true" html="true" source="tabbed-right" title="Diagrams" +````md exec="1" source="tabbed-right" title="Diagrams" +```python exec="true" html="true" --8<-- "gallery/diagrams.py" ``` +```` ## Python dependency tree @@ -34,16 +36,16 @@ from our own package. ````md exec="1" source="tabbed-right" title="pipdeptree mermaid diagram" ```bash exec="1" result="mermaid" pipdeptree -p markdown-exec --mermaid 2>/dev/null | - sed 's/flowchart TD/flowchart LR/' | - sed 's/\.dev.+"\]$/"]/;s/\+d.*"\]$/"]/' + sed -E 's/\.dev.+"\]$/"]/;s/\+d.*"\]$/"]/' ``` ```` -Another example with more dependencies and top-down direction: +Another example with more dependencies: ````md exec="1" source="tabbed-right" title="pipdeptree mermaid diagram" ```bash exec="1" result="mermaid" -pipdeptree -p mkdocstrings-python --mermaid 2>/dev/null +pipdeptree -p mkdocstrings-python --mermaid 2>/dev/null | + sed 's/flowchart TD/flowchart LR/' ``` ```` @@ -60,9 +62,11 @@ so the code is a bit convoluted, but you could make a function of it, put it in an importable script/module, and reuse it cleanly in your executed code blocks. -```python exec="true" html="true" source="tabbed-right" title="pydeps module dependencies graph" +````md exec="1" source="tabbed-right" title="pydeps module dependencies graph" +```python exec="true" html="true" --8<-- "gallery/pydeps.py" ``` +```` ## Code snippets @@ -73,9 +77,11 @@ from somewhere else using the or by reading it dynamically from Python. We also prevent Rich from actually writing to the terminal. -```python exec="true" html="true" source="tabbed-right" title="Rich SVG code snippet" +````md exec="1" source="tabbed-right" title="Rich SVG code snippet" +```python exec="true" html="true" --8<-- "gallery/rich.py" ``` +````