The terminal few letters of whatever I write in the mermaid code block always get swallowed by the margin of the graphic within which the text is supposed to appear. I’ve attached a screenshot to illustrate this issue.
I’ve looked through the mermaid related topics on the forum and haven’t found anything related to this.
I’m not a programmer at all and have zero coding abilities, but I love using this app to make notes and having them handy on other devices.
Any help will be greatly appreciated.
Thank you.
I’ve never used any custom css. Don’t even know how to, in fact.
I didn’t know there was custom css to change mermaid chart widths… maybe I should try that?
Thanks for replying. While the problem is rather minor, it still bugs me. At least now I know this isn’t a universal problem and there must be a way to fix it.
This should open up a text file that is empty apart from the line:
/* For styling the rendered Markdown */
Paste the additional text below into the file so that it now looks like:
/* For styling the rendered Markdown */
svg[id^="mermaid-"] {
min-width: 200px;
max-width: 500px;
}
Save and close the text file.
Quit Joplin and restart Joplin. That means you have to use File > Quit rather than the X in the top right corner of the Joplin window.
When restarted Mermaid diagrams will be limited to a minimum width of 200 pixels and a maximun width of 500 pixels. You can experiment with the values but you must restart Joplin every time you make a change.
I'm not overly convinced that this will solve your problem so if you want to go back to how it was before, just delete the text you added to that file, save it, and restart Joplin again.
I have been having a rummage through how the Mermaid charts are displayed and it seems that Mermaid’s preferred font for the text is “Trebuchet MS”. It should be on your system as it is a default font for Win10. You haven’t uninstalled it by any chance?
If the font is present I also found that it is actually possible to change the font of the Mermaid chart text. I therefore wondered if using a narrower or condensed font may help you. This can be achieved by adding css like this.
/* For styling the rendered Markdown */
:root {
--mermaid-font-family: "Bahnschrift SemiCondensed" !important;
}
Example
I picked Bahnschrift because it is also a Win10 default font so you should have it on your system. It’s difficult for me to confirm that this will work for you as the charts display correctly for me. It could be that the chart just shrinks the box sizes! Hopefully not.
If this causes problems for any other charts you have you can, like before, just delete the above lines and all will revert to normal.