-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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.js generated SVG pictures with too many blank spaces taking up space. #4068
Comments
|
This is an exact duplicate of #3947. Closing. |
Thanks for providing the details. As we can see in your screenshot, it is clearly the |
You can define a custom mermaid.js version like so: #3171 (comment) |
I had tried many versions of mermiad.js on material, no one works well. I had tried many versions of mermaid.js on the plugin, each one works well, even v9.0.1. What is the problem? |
Mermaid in material is faster than mermaid plugin, so please fix the bug, thank you! |
Thanks for testing the different versions. As I already noted in #3947 (comment), this is an upstream bug: |
But why mermaid plugin works well? Maybe you can fix it like the plugin, see mermaid-js/mermaid#2657 (comment) |
Just throwing a solution out here: mkdocs-matrial creates shadowroots for each diagram, in so avoiding other issues with duplicate id's etc, which is smart but it also makes it impossible to just use css to access elements (svg tag) inside the generated div tags. Edit: bundle.467223ff.min.js .................
let t=`__mermaid_${ps++}`,r=C("div",{class:"mermaid"});
// console.log('mermaid');
mermaid.mermaidAPI.render(t,e.textContent,n=>{
// console.log('mermaid api render callback textcontent', e.textContent);
let o=r.attachShadow({mode:"closed"});
// console.log('object with attached Shadow root', o);
o.innerHTML=n,e.replaceWith(r);
// console.log('innerhtml set', o.innerHTML);
let firstSvg = o.querySelector('svg');
if (firstSvg) {
//firstSvg.setAttribute('height', 'auto');
firstSvg.style.height = 'auto';
}
})}),Gr.pipe(Z({ref:e}))}function ms(e,{target$:t,print$:r}){let n=!0;ret ....... Ofcourse, when upgrading mkdocs-material this solution is overwritten but in the meantime it's a workaround. |
Contribution guidelines
I've found a bug and checked that ...
mkdocs
orreadthedocs
themescustom_dir
,extra_javascript
andextra_css
Description
If the block of code for mermaid is so long that it exceeds the height of the SVG that the target is generating, the upper and lower parts of the generated SVG will take up a lot of invalid space.
Expected behaviour
SVG just happens to appear below the text
Actual behaviour
Steps to reproduce
Package versions
Configuration
System information
The text was updated successfully, but these errors were encountered: