-
Notifications
You must be signed in to change notification settings - Fork 250
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
improve performance of markdown file processing #694
Comments
yeah that ^^^ and also a switch from puppeteer to playwright would allow processing multiple images (pages) at once -- or just skip that step and use a custom renderer (or any lib that doesn't require me to install chromium pleeeease!) |
Skip launching puppeteer until it's actually needed. Running mermaid-cli on a markdown file without any mermaid code blocks shouldn't launch puppeteer, if it's unnecessary. Fix: mermaid-js#694
Good idea! I think the slowest part is actually launching
However, it still needs to create a browser instance per You can use remark-mermaid-dataurl if you want to process multiple There's also remark-mermaidjs, which is similar, but uses Playwright instead of Puppeteer.
Unfortunately, Mermaid needs a CSS layout engine to render properly, and as far as I'm aware, only browsers support this. See mermaid-js/mermaid#3650. Although, maybe https://github.com/servo/servo will help in the far future 🤷 You can use Puppeteer with Firefox, though: https://pptr.dev/faq#q-what-is-the-status-of-cross-browser-support |
Skip launching puppeteer until it's actually needed. Running mermaid-cli on a markdown file without any mermaid code blocks shouldn't launch puppeteer, if it's unnecessary. Fix: #694
when you have a lot of markdown files to process with mmdc (using xargs or similar), and only some of them contain mermaid diagrams, it takes relatively a lot of time to process those .md files that do not contain any diagram.
regex processing is relatively heavy. it might accelerate performance if, before processing regex to extract the diagrams from the file, the script will do a simple check if the file contains any
```mermaid
string.it seems like a small change in index.js, but I'm not proficient enough in my js to write the code.
For your consideration.
The text was updated successfully, but these errors were encountered: