Add sphinx_runpython.runmermaid extension for Mermaid diagram support#58
Merged
Merged
Conversation
Agent-Logs-Url: https://github.com/sdpython/sphinx-runpython/sessions/d8720735-e1ac-42f5-8f74-5cb189420a5e Co-authored-by: xadupre <22452781+xadupre@users.noreply.github.com>
Agent-Logs-Url: https://github.com/sdpython/sphinx-runpython/sessions/d8720735-e1ac-42f5-8f74-5cb189420a5e Co-authored-by: xadupre <22452781+xadupre@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add functionality to extend runpython for graph plotting with mermaid
Add May 4, 2026
sphinx_runpython.mermaid extension for Mermaid diagram support
xadupre
reviewed
May 4, 2026
Agent-Logs-Url: https://github.com/sdpython/sphinx-runpython/sessions/0b9e316d-85dd-491f-a8fe-fcb57e2c1479 Co-authored-by: xadupre <22452781+xadupre@users.noreply.github.com>
Copilot
AI
changed the title
Add
Add May 4, 2026
sphinx_runpython.mermaid extension for Mermaid diagram supportsphinx_runpython.mermaidjs extension for Mermaid diagram support
xadupre
reviewed
May 4, 2026
Agent-Logs-Url: https://github.com/sdpython/sphinx-runpython/sessions/d779d538-fb95-4f79-ba03-95dfc33cf6e0 Co-authored-by: xadupre <22452781+xadupre@users.noreply.github.com>
Copilot
AI
changed the title
Add
Add May 4, 2026
sphinx_runpython.mermaidjs extension for Mermaid diagram supportsphinx_runpython.runmermaid extension for Mermaid diagram support
xadupre
reviewed
May 4, 2026
Agent-Logs-Url: https://github.com/sdpython/sphinx-runpython/sessions/08981185-c76f-49f9-bc90-02ba60e6c5ac Co-authored-by: xadupre <22452781+xadupre@users.noreply.github.com>
Collaborator
|
@copilot merge with main branch |
…hon-plot-graph-mermaid Co-authored-by: xadupre <22452781+xadupre@users.noreply.github.com>
Contributor
Author
Copilot AI
added a commit
that referenced
this pull request
May 4, 2026
Agent-Logs-Url: https://github.com/sdpython/sphinx-runpython/sessions/15edfe84-fbd3-4ec9-a96d-dd20182e8f72 Co-authored-by: xadupre <22452781+xadupre@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a new
sphinx_runpython.runmermaidSphinx extension exposing a.. runmermaid::directive that renders Mermaid diagrams. The namerunmermaidavoids conflicts with the existingsphinxcontrib-mermaidextension (which also registers.. mermaid::) and themermaid-pyPython package. HTML output is rendered client-side via the Mermaid CDN JS library; LaTeX/text/RST outputs fall back to verbatim source.New extension:
sphinx_runpython/runmermaid/RunMermaidDirective–.. runmermaid::directive with::script:– body is Python code whosestdoutis the diagram definition; an optional string value acts as a split token (only output after that token is used):process:– run the script in a subprocess<pre class="mermaid">), RST, text, and LaTeXadd_mermaid_js–builder-initedhook that injectsmermaid.min.jsfrom CDN into HTML pagesUsage
Supporting changes
_doc/conf.py– extension registered assphinx_runpython.runmermaid,Mermaidadded toepkg_dictionary_doc/api/runmermaid.rst+_doc/api/index.rst– documentation page_unittests/ut_runmermaid/test_runmermaid_extension.py– 5 tests covering inline RST/HTML rendering, script execution, split-token filtering, and caching