Skip to content

Conversation

timhoffm
Copy link
Contributor

@timhoffm timhoffm commented Aug 24, 2025

Closes: #2249

The handling is completely analoguous to the existing handling of graphviz here.

sphinxcontrib-mermaid generates the following HTML

475613612-a34f1441-ca54-4f31-a51c-668731175b41

Therefore, the selector pre.mermaid > svg is suitable.

@stevepiercy
Copy link
Contributor

Unrelated to this PR, and according to the failed check at https://github.com/pydata/pydata-sphinx-theme/actions/runs/17194519135/job/48774620104?pr=2250, it appears that PyTorch changed the URL of its logo from:

https://docs.pytorch.org/docs/stable/_static/images/logo-dark.svg

to:

https://docs.pytorch.org/docs/stable/_static/img/logo.svg

However its logo might not appear well in light mode. PyTorch's documentation's primary navbar background color remains dark in any mode.

There's also this version in the repo:

https://raw.githubusercontent.com/pytorch/pytorch/refs/heads/main/docs/source/_static/img/pytorch-logo-dark.svg

@drammock
Copy link
Member

thanks @timhoffm! I've pushed a few commits to make it work (new SCSS files need to be imported in our root file), make sure the extension is installed for our own doc build, and add a documentation page.

Copy link
Contributor

@stevepiercy stevepiercy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a couple of questions.

I've done similar for Plone docs at https://6.docs.plone.org/contributing/documentation/myst-reference.html#diagrams-and-graphs-with-mermaid

For examples, have you tried https://ebp-sphinx-examples.readthedocs.io/en/latest/? I don't know if it works for reStructuredText, as I use it exclusively for MyST.

@@ -0,0 +1,48 @@
========
Mermaid
========
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do the over/underlines length need to exactly match the length of the title?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no.

Comment on lines +43 to +44
:start-after: begin-example-mermaid
:end-before: .. end-example-mermaid
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should these values both have a leading .. or none?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

first one doesn't need it, but it wouldn't hurt. Second one does need it. I tend to omit .. on the first one so that the text aligns nicely on the two lines.

@drammock
Copy link
Member

For examples, have you tried ebp-sphinx-examples.readthedocs.io/en/latest?

Nope. As the prominent warning states, it only works on pages written in .md, not .rst

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Dark theme support for sphinxcontrib-mermaid plugin
3 participants