-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Mermaid rendering but not appearing within Content Tabs #3377
Comments
Material doesn't use the |
The Mermaid still renders if you're importing the Mermaid JS directly etc etc |
Mermaid was never "moved" to Insiders, support was added in Insiders. I'll explain. Yes, Mermaid should work without special support, but the Mermaid library is quite quirky. For instance, see this issue I created that still hasn't been addressed: mermaid-js/mermaid#1318. The default Mermaid loader, frankly, isn't too great. Additionally, some of their approaches don't work well in hidden elements, like what content tabs employ. This is why, even though Mermaid is supposed to "just work", Material has added "special" support. In order to work around such issues, I devised a way that avoided using Mermaid's default loader and instead uses a loader that wraps the content in a shadow DOM to avoid many of the issues I found. I talk about it here: https://facelessuser.github.io/pymdown-extensions/extras/mermaid/. I also have a working example here: https://codepen.io/facelessuser/pen/oNeNydQ. Material, to help make using UML "easy" for its users took a lot of what I did and created a solution that works with Material out of the box and styles the diagrams in a way that matches Material's style. You do not have to use Material's solution, but you will run into issues if you rely on Mermaid's loader and use things like content tabs. You can look into the example I provided to solve such issues, or you can use Material's built-in solution, but currently, there is only pain using Mermaid's default loader. |
Just an FYI, I don't use the insiders solution currently. |
@facelessuser that's worked perfectly. Thanks very much for your help. Sorry to be a pain, but, any idea why Material CSS is no longer applied? Before After |
I honestly don't know. Does Material provide special styling for Mermaid on non-insiders? From what I recall, it provides no actual styling to Mermaid elements, maybe the container, but I am pretty sure that is all. Insider's provides more in-depth styling. I imagine anything you see can be controlled via the Mermaid config. Maybe that is due to HTML labels being enabled? I usually disable those. I guess I'd have to know more about your setup. |
I guess it could be possible Material provides some basic styling that bled into diagrams. Maybe due to the way my solution wraps them, they aren't seen as well. They are now wrapped in a shadow DOM and should be isolated to some extent from external styling. Styling would mainly be controlled through the Mermaid config. |
Contribution guidelines
I've found a bug and checked that ...
mkdocs
orreadthedocs
themescustom_dir
,extra_javascript
andextra_css
Description
Rendered Mermaid diagrams are not appearing within content tabs. As you can see below, the diagram is rendered, but the content tab is not expanding to show the diagram itself:
Expected behaviour
Mermaid diagrams are able to be nested within content tabs.
Actual behaviour
Contents tabs do not resize to the nested Mermaid diagrams.
Steps to reproduce
Package versions
3.9.7
1.2.2
8.12
Configuration
System information
The text was updated successfully, but these errors were encountered: