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

Text does not fit in nodes #18

Closed
fkohrt opened this issue Mar 21, 2021 · 2 comments · Fixed by #343
Closed

Text does not fit in nodes #18

fkohrt opened this issue Mar 21, 2021 · 2 comments · Fixed by #343

Comments

@fkohrt
Copy link

fkohrt commented Mar 21, 2021

Sometimes nodes are too small to fit the text inside them. Strangely, this is only an issue for mermaid.ink, but not for "Download SVG" at the Mermaid Live Editor.

Take, for example, the following code:

graph TD
    A("I don't know what to write here (brackets)")
    B("I need some more inspiration")
    C("What is it that I could write here?")
    D("This is the last piece of content")

    A --- B
    B --- C
    A --- D

Loading

The last text part of each node is cut off:

mermaid

Links with this example:

@jihchi
Copy link
Owner

jihchi commented Apr 3, 2021

Hi @fkohrt , Thanks for reporting!

I have taken a look and it seems to be an issue on mermaid.js side, see similar issues:

There is a work-around by setting an extra CSS, please see here.

For example, add following code into Mermaid Configuration:

{
  "themeCSS": ".label foreignObject { font-size: 90% }"
}

It will looks like this:
scale font-size by 90%

@fkohrt
Copy link
Author

fkohrt commented Apr 3, 2021

Hi @jihchi, thanks for following up and the quick fix! Closing this as it's an issue with upstream.

@fkohrt fkohrt closed this as completed Apr 3, 2021
davejm added a commit to davejm/mermaid.ink that referenced this issue Apr 21, 2024
…e other things including text overflow bug.

New additions:

- Allow setting image size with width, height and scale URL parameters. If width and height are unset, the behaviour is as before to keep backwards compatibility. (fixes jihchi#131, jihchi#85)
- Allow setting maximum allowed image width and height via ENV var
- Allow setting custom font-awesome CSS URL for SVG via ENV var
- Add support for PDF output with options for setting paper size format, fitting PDF size to image, setting landscape (fixes jihchi#303)
- Allow setting "site-wide" diagram theme using theme URL parameter (fixes jihchi#231)
- Add examples of new features to index.html page

Fixes/improvements:

- Fix google chrome executable path for Puppeteer by making absolute
- Fix typo in .dockerignore that was causing docker image build issues
- Fix corepack pnpm not being present for node user in docker image
- Add some extra error handling in getOptionsFromCode for state deserialization
- Fix to make sure "mermaid" key from deserialized state is parsed as JSON
- Remove unnecessary font-awesome v4-shims CSS from mermaid.html (all.min.css should be enough)
- Fix text overflow caused by font-awesome font loading by waiting for page fonts to load (fixes jihchi#18)
- Use the same version of CDN-hosted font-awesome CSS in SVG as vendored font-awesome by default
- When outputting SVG, clone the SVG element before injecting CDN-hosted font-awesome CSS to prevent unnecessary load on server-side
- Use XMLSerializer instead of manual tag fixing to ensure SVG is properly converted to XML when outputting SVG
- Use sharp image processor and pdf-lib packages in tests to validate format, size etc.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants