Skip to content
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 diagram gets cut off at the bottom #125

Closed
corinnekaryiu opened this issue Apr 30, 2022 · 2 comments
Closed

Mermaid diagram gets cut off at the bottom #125

corinnekaryiu opened this issue Apr 30, 2022 · 2 comments
Assignees
Labels
🐛 bug Something isn't working

Comments

@corinnekaryiu
Copy link
Contributor

corinnekaryiu commented Apr 30, 2022

Hi, this is a strange issue I've noticed on Primary. When I have a long Mermaid graph, the SVG gets cut off at the bottom. I'm using v0.14.7 on Mac.

For example, if I use this codeblock:

graph TD
1([Tadasana]) --> 2[Urdhva Hastasana] --> 3[Uttanasana] --> 4[Ardha Uttanasana] --> 5[Phalakasana] --> 6[Chaturanga Dandasana] --> 7[Urdva Mukha Svanasana] --> 8[Adho Mukha Svanasana] --> 9[Anjaneyasana] --> 4[Ardha Uttanasana] --> 3[Uttanasana] --> 1([Tadasana])
class 1,2,3,4,5,6,7,8,9 internal-link

... it gets cut off on Primary and is misaligned to the right:

Screenshot 2022-04-30 at 21 25 37

... but on the default theme it looks fine:

Screenshot 2022-04-30 at 21 36 07

... it also works correctly on the LYT theme where it is centered as intended:

Screenshot 2022-04-30 at 21 35 35

The vault I'm testing this with has no community plugins, snippets or custom style settings enabled. I've tried using the inspector to work out what is causing this, but haven't managed to figure it out yet.

My temporary fix is to add overflow: visible to .mermaid svg but this does mean that any blocks below will overlap, so it's not ideal.


EDIT:

I think I've figured out why this issue is happening, but don't know the root cause.

When using the Primary theme, the diagram renders in HTML with the following properties: height="801.984375" viewBox="-111.4375 -30.234375 369.3125 801.984375"

On the default theme, it renders like so: height="812" viewBox="0 0 266.703125 812" and on LYT: height="812" viewBox="0 0 257.8828125 812"

So something in Primary seems to be causing the SVG to load with the incorrect height and a strange offset in the viewBox 🤔


Would be great if you could look into this or let me know what might be causing it! Thanks 🙂

@corinnekaryiu
Copy link
Contributor Author

Hey @ceciliamay, thanks so much for looking into this!

Unfortunately, even after updating the theme, it hasn't fixed the issue. However, I think I've figured it out!! 🙌🏻

I noticed that the diagram only gets cut off when I'm using internal links within the graph - the CSS transition effect on these links seems to be conflicting with the sizing of the Mermaid diagram. I fixed it by adding this into one of my snippets:

.mermaid .internal-link {
  transition: none !important;
}

I hope this helps - feel free to add this into a future update if it helps! 😄

@ceciliamay ceciliamay reopened this May 8, 2022
@ceciliamay ceciliamay self-assigned this Apr 4, 2024
@ceciliamay ceciliamay added the 🐛 bug Something isn't working label Apr 4, 2024
@ceciliamay ceciliamay moved this to Todo in ⭕ All Tasks Apr 4, 2024
@ceciliamay ceciliamay moved this from Todo to For Release in ⭕ All Tasks May 17, 2024
@ceciliamay ceciliamay moved this from For Release to Done in ⭕ All Tasks Jun 24, 2024
@ceciliamay ceciliamay moved this from Done to Todo in ⭕ All Tasks Jul 10, 2024
@ceciliamay
Copy link
Collaborator

hey there! investigated this issue today, and with primary v2.8.0 (and now v2.10.0-beta), the issue doesn't seem to be occurring anymore. so i will close it now. thank you for all your help!! i appreciate it a lot 💛

@github-project-automation github-project-automation bot moved this from Todo to Done in ⭕ All Tasks Sep 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working
Projects
Status: Done
Development

No branches or pull requests

2 participants