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 does not show properly #2212

Closed
2 tasks done
victor-navarro opened this issue Feb 19, 2024 · 5 comments
Closed
2 tasks done

Mermaid diagram does not show properly #2212

victor-navarro opened this issue Feb 19, 2024 · 5 comments

Comments

@victor-navarro
Copy link

victor-navarro commented Feb 19, 2024

Have you checked that your issue isn't already filed?

  • I read through FAQ and searched through the past issues, none of which addressed my issue.
  • Yes, I have checked that this issue isn't already filed.

Bug description

Diagrams larger than the current example will display incorrectly in two ways: 1) will be occluded on the right, and 2) will be occluded on the bottom if they are too long

How to reproduce the bug

To reproduce the width issue:

Go to https://alshedivat.github.io/al-folio/blog/2021/diagrams/

Drag the diagram to the right.

I could not reproduce the height issue with sequenceDiagrams (the mermaid diagram used in the example). However, things break down if you use other types.

Using the below will lead to a diagram that gets cut at the bottom, even though this diagram renders fine in other places (such as markdown preview and here, see below):

```mermaid
classDiagram
    note "From Duck till Zebra"
    Animal <|-- Duck
    note for Duck "can fly\ncan swim\ncan dive\ncan help in debugging"
    Animal <|-- Fish
    Animal <|-- Zebra
    Animal : +int age
    Animal : +String gender
    Animal: +isMammal()
    Animal: +mate()
    class Duck{
        +String beakColor
        +swim()
        +quack()
    }
    class Fish{
        -int sizeInFeet
        -canEat()
    }
    class Zebra{
        +bool is_wild
        +run()
    }
```

It renders fine here:

classDiagram
    note "From Duck till Zebra"
    Animal <|-- Duck
    note for Duck "can fly\ncan swim\ncan dive\ncan help in debugging"
    Animal <|-- Fish
    Animal <|-- Zebra
    Animal : +int age
    Animal : +String gender
    Animal: +isMammal()
    Animal: +mate()
    class Duck{
        +String beakColor
        +swim()
        +quack()
    }
    class Fish{
        -int sizeInFeet
        -canEat()
    }
    class Zebra{
        +bool is_wild
        +run()
    }
Loading

Error messages and logs

The error message you got, with the full traceback if available. Please paste it between these triple backticks.

What operating system are you using?

Windows

Where are you seeing the problem on?

Running locally with Docker

More info

No response

@george-gca
Copy link
Collaborator

Somehow the generated svg is ending with style="max-width: 684.6133422851562px;". Probably fixing this will solve the problem.

@victor-navarro
Copy link
Author

Somehow the generated svg is ending with style="max-width: 684.6133422851562px;". Probably fixing this will solve the problem.

I noticed that too, the value on my end is equally arbitrary (and different). I tried tinkering with the css to no avail, and after some reading, it seems that the property is being determined elsewhere.

@george-gca
Copy link
Collaborator

I tried to check if I could fix it quickly, but it seems to need a "magical" solution.

Copy link

stale bot commented May 1, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label May 1, 2024
@george-gca george-gca removed the wontfix label May 1, 2024
Copy link

stale bot commented Jun 30, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Jun 30, 2024
@stale stale bot closed this as completed Jul 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants