question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Text is cut off in SVG exported from live editor

See original GitHub issue

The following Mermaid markup generates this live view:

graph TD
A[Something] -->|begets| B[Something]

(Config is {}.)

image

However, in the exported SVG all text boxes are cropped on the right side:

image

Am I missing something?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:13
  • Comments:13 (2 by maintainers)

github_iconTop GitHub Comments

11reactions
trueskawkacommented, Apr 2, 2019

I was able to address this issue when using the CLI to generate PNG by adding CSS to the parent element for edgeLabel. The foreignObject width is too narrow for labels to be properly displayed, so it should allow for overflow (I think the math might be slightly off when calculating the label width).

.label foreignObject {
    overflow: visible;
}

It doesn’t seem to be working for SVG, but it might be a similar issue.

Edit: Oh, interesting, it does work if I pass the themeCSS, but not when I’m using a CSS file for the -C flag.

If you add this to the config, it should fix the label width:

"themeCSS": ".label foreignObject { overflow: visible; }"
2reactions
Drunkmancommented, Aug 14, 2019

I add this to config, and it work well.

{
    "themeCSS": ".label foreignObject { font-size: 14px; }"
}

But I still don’t know why mermaid add a style that make the font-size large so that graph label be cut off.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why text in exported SVG images may not display correctly
Simple explanation : The exported SVG is only designed to be displayed in web pages, we didn't design the output to be editable...
Read more >
Numbers in SVG cut off, how do I restore them?
text clipped. To remove the clipping mask, open your SVG file in Inkscape, select your object, in object menu choose clip and release:....
Read more >
Optimizing SVG Exported from Figma | platformOS Docs
Export a flowchart image as SVG with editable text; Optimize its size and structure so it's easy to edit; Try to preserve as...
Read more >
Is some of your text getting cut off after download? - Creatopy
That happens because the text box gets converted into SVG, and everything outside the box or any element that is touching the border,...
Read more >
How To Export A SVG File In Illustrator CC - YouTube
Learn how to export an SVG file in Adobe Illustrator CC in this super easy tutorial.#illustrator#vector#illustrator2022For use in web design ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found