Mermaid scaling to increse the quality of the genrated PNG files#207
Open
slohat-enestit wants to merge 2 commits into
Open
Mermaid scaling to increse the quality of the genrated PNG files#207slohat-enestit wants to merge 2 commits into
slohat-enestit wants to merge 2 commits into
Conversation
…ome scaling to increse the quality of the genrated PNG files
johndgiese
reviewed
Nov 4, 2025
|
|
||
| mermaid_config = { | ||
| "flowchart": {"useMaxWidth": True}, # Forces diagrams to use available width | ||
| "theme": "default", |
Contributor
There was a problem hiding this comment.
Are the theme and themeVariables necessary? If not, I suggest we remove them. If you could show an image with/without the theme that'd be great.
Also, would setting the theme here prevent user's from customizing the theme themselves if they wanted to?
Collaborator
Author
There was a problem hiding this comment.
Contributor
There was a problem hiding this comment.
would setting the theme here prevent user's from customizing the theme themselves if they wanted to
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Mermaid scaling to increse the quality of the genrated PNG files
Link to issue
https://www.notion.so/medtech-os/Mermaid-Diagram-Export-Resolution-25ff235c3b48809b9976ea0bb23d7a1f
Describe Your Changes
We have updated the configurations settings while genrating the PNG output.
Initially , the output PNG was not so readable and clear in the output DOCX file because of the way the MS Word renderizes the mermaid diagram.
The first step i.e mermaid_config plays a crucial role and controls the structure and how the diagram looks.
Hence , we set up some theme variables that affect the various visual aspects of mermaid flowchart and configured it to use full available width to enhance clarity
The pupeeter config renders the image in a headless browser and I added the scaling factor in its config so that it renders the
mermaid diagram into a image with high pixel density.
Finally , before showing the final output PNG to the user , I added a scaling factor of 3 , which acts as a "zooming" factor
and enhances readability of the output image.
How Did You Test It
We have tested it on local machine using diffrent mermaid digrams from the notion page
notion_export_png.docx