-
Notifications
You must be signed in to change notification settings - Fork 347
Fix display of mermaid diagrams in dark mode #2250
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Closes: pydata#2249 The handling is completely analoguous to the existing handling of graphviz [here](https://github.com/pydata/pydata-sphinx-theme/blob/main/src/pydata_sphinx_theme/assets/styles/extensions/_graphviz.scss).
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: |
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. |
There was a problem hiding this 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 | |||
======== |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no.
:start-after: begin-example-mermaid | ||
:end-before: .. end-example-mermaid |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
Nope. As the prominent warning states, it only works on pages written in |
Closes: #2249
The handling is completely analoguous to the existing handling of graphviz here.
sphinxcontrib-mermaid generates the following HTML
Therefore, the selector
pre.mermaid > svg
is suitable.