-
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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
Massive whitespace above and below graph #1984
Comments
Adding to this, I am getting the same issue with very long sequence diagrams when previewing in Visual Studio Code and in the live editor. I was using Markdown PDF by yzane.markdown-pdf version 1.4.4 and VS Code 1.55.2 on Windows. Curiously, I don't get the same issue when I generate a PNG or SVG image using the same diagram with the npm package |
This is how the cli renders the flow chart as discussed above with 200 repetitions As you can see, it does now have spacing to the right which I don't think is an issue. This, however, is how it looks when embedded into a markdown document and previewed using VSCode Notice the spacing on the top and bottom. |
For SVGs I could fix the whitespace by removing the height value from svg tag. Tested only in Firefox.
to
Hope this helps track down the issue. |
For me, the same issue arises for a sequence diagram, for which there are 100 lines (including a 8x If you put the following into the live editor, you'll see already quite some spacing at top and bottom. If you add/remove participants you'll see the effect. Unfortunately, it also depends on the screen resolution/window viewport width. sequenceDiagram
autonumber
participant A
participant B
participant C
participant D
participant E
participant F
participant G
A->>B: Task
A->>B: Task
A->>B: Task
A->>B: Task
A->>B: Task
A->>B: Task
A->>B: Task
A->>B: Task
A->>B: Task
A->>B: Task
A->>B: Task
A->>B: Task
A->>B: Task
A->>B: Task
A->>B: Task
A->>B: Task
|
I am getting similar behaviour with flowcharts |
Having this same issue, would love a fix! |
If it helps on anything, this regression was introduced with |
If I switch to |
We have the same problem in Joplin. People have found a workaround by adding the following css:
@knsv ^^^ |
I am bumping into the same issue with Github rendering. Any news on this front? |
Also hitting this issue on github. Here's an anonymised version of what I'm using.
sequenceDiagram
a->>b: text here
a->>b: text here
b->>a: text here
a->>b: text here
a->>c: text here
c->>d: text here
c->>e: text here
f->>b: text here
b->>a: text here
a->>g: text here
b->>h: text here
|
Note: Mermaid version will need to be bumped here when this issue is fixed(mermaid-js/mermaid#1984)
+1 |
FYI: There is the same issue if you generate a PNG
For me, it's fine to use SVG. |
I just ran into this exact same issue in two places. I wrote a fairly long sequence diagram in VS Code, then uploaded it to GitLab as a snippet. VS Code: 1.68.0, running on Windows 10
Gitlab 15.0 (viewing in Firefox) |
The proposed workarounds using |
Hi, |
This issue on my Github pages was solved and the massive blank is gone: that's amazing, thanks devs! ❤️ : |
Do you mind explaining how? |
If only I knew! I went back to it today after months of absence, and the blank was gone. You can find the flowchart here and the code is avaiable on the raw view of the README :) I wish I could be more useful, but mermaid is a (beautiful) mystery to me! |
👋 Padding is now being handled appropriately on the GitHub side, so that'll be why the problem is fixed in Pages! 🙂 (I believe the underlying Mermaid issue remains.) |
My issue is on Gitlab so it's not fixed for me. :( |
Same. See this issue with the Sequence Diagrams in Preview with VS Code. When exporting to various formats it remains. Are there any MM devs looking at this, it's been going on for a long time. |
👀 running into this one as well. Would be nice to see the underlying issue here addressed |
Similar issue with Sphinx on ReadTheDocs |
Where you able to fix this? I am also facing this problem for mermaid sequence diagrams in md files. |
Try adding a custom.css in your root assets folder with this syntax .mermaid svg { height: auto; padding: 20pt; } |
That doesn't work where you have no control over CSS, like on Gitlab Wikis. |
I also arrived here because of this issue in gitlab wiki. |
I am experiencing similar issues with excessive top/bottom margin (whitespace) for larger flow charts. This flowchart renders nicely here but in Docsy and in Mac version of VS Code (v1.17.2) with Markdown Preview Mermaid Support (v1.15.2) there are excessive top and bottom margins - each roughly same height as flowchart (below). Note: setting useMaxWidth to false does make a difference but doesn't solve problem completely. ;-) %%{init: {"flowchart": {"useMaxWidth": false}}}%% flowchart LR
classDef subgraph_padding fill:none,stroke:none
COMP(Composite Application)
subgraph STD["Procedure Camera AI Workload (25 fps)"]
subgraph ugly_hack1 [ ]
C1(Endoscope Camera)
S1(Ingest Video);
P1(Prepare Image);
subgraph I1[Image Inference Block]
MR1[( Model Repo)]
TTD(Tooltip Detection)
ASD(Anat. Struct. Detection)
end
E1(Export Results);
end
end
subgraph SPD["PTZ Camera AI Workload (1 fps)"];
subgraph ugly_hack2 [ ]
C2(PTZ Camera);
S2(Ingest Video);
P2(Prepare Image);
subgraph I2[Image Inference Block]
MR2[( Model Repo)]
PHD(Phase Detection)
FB(Face Blur)
OD(Object Detection)
end
E2(Export Results);
end
end
subgraph VID[Video Controller]
VC(Video Composite)
VS(Video Switch)
end
subgraph SC[Shared Components]
SMR[(Global Model Repo)]
end
%% create transparent subgraphs to kludge desired layout for subgraph titles. -ec 22.09.19
class ugly_hack1 subgraph_padding
class ugly_hack2 subgraph_padding
COMP--contains-->STD;
COMP--contains-->SPD;
COMP--contains-->SC;
COMP--contains-->VID;
%% Procedure Camera AI Workflow, etc.
C1-->S1;
S1-->P1;
P1-->TTD;
P1-->ASD;
TTD-->E1;
ASD-->E1;
%% PTZ Camera AI Workflow, etc.
C2-->S2;
S2-->P2;
P2-->PHD;
P2-->FB;
P2-->OD;
PHD-->E2;
FB-->E2;
OD-->E2;
%% Video Controller and Display
C1-->VC
C2-->VC
E1-->VC
E2-->VC
VC-->VS
VS-->QD[Quad Display]
VS-->SD[Single Display]
VS-->TP[Telepresense]
VS-->DICOM[(DICOM Database)]
%% Inference Workloads and Model Repos
TTD-.uses.->MR1;
ASD-.uses.->MR1;
PHD-.uses.->MR2;
FB-.uses.->MR2;
OD-.uses.->MR2;
MR1-.uses.->SMR;
MR2-.uses.->SMR;
|
+1 |
If you are facing this issue with MermaidJS macro in Atlassian Confluence, here is how to resolve it until this issue is addressed. |
I sort of used a workaround for this in my Confluence page. Here's what I did:
This also solved another problem for me, which was that for larger diagrams, I was unable to expand them and see the smaller text. I was also able to wrap it up neatly inside an "expand" macro, so it ended up looking pretty neat. Attached screenshot for reference. |
We are using Mermaid in MkDocs and facing the same issue. |
Any update? This ticket is 3+ years old, simply to remove whitespace. This is enough to make some users deter to other tools over Mermaid. |
Describe the bug
Very large charts result in massive amounts of excess whitespace above and below the diagram making it practically unusable. I was using mermaid to chart a family tree with approximately 400 relationships/nodes. Performance is very acceptable for such an application, so it's unfortunate that I've encountered this issue.
To Reproduce
Steps to reproduce the behavior:
The family tree contains confidential information so I cannot post it, but the problem can easily be reproduced by repeating the simple relationship below. I'm showing 5 repetitions below. The problem starts manifesting itself after about 50 repetitions and becomes extremely problematic at around 150, getting progressively worse as more elements are added to the graph.
50 repetitions:
150 repetitions:
Here's what I'm experiencing with the actual family tree. The first example is using the VS Code mermaid extension. Please note the size of the scrollbar handle on the right to get an idea how much empty space is above and below the diagram in addition to the empty space in the visible portion.
The second example is using mermaid in Joplin. Here's what PDF output looks like, and the same amount of empty space is present in the live view.
The problem can also be reproduced in the Live Mermaid Editor. Here's what happens with 500 repetitions of the aforementioned example:
Expected behavior
The size should be limited to the visible extent of the graph.
Screenshots
See above.
Desktop (please complete the following information):
Smartphone (please complete the following information):
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: