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

Add support for lazyLoadedDiagrams (mermaid v9.2.0) #420

Closed
wants to merge 5 commits into from

Conversation

aloisklink
Copy link
Member

📑 Summary

Mermaid v9.2.0 added support for custom diagrams using lazyLoadedDiagrams, such as the new @mermaid-js/mermaid-mindmap plugin diagram.

This PR bumps the minimum required version of mermaid to v9.2.0, adds support for lazyLoadedDiagrams (needed to switch the Mermaid rendering code to async) and adds some test cases/docs.

Resolves #406

📏 Design Decisions

mermaid-mindmap is opt-in (disabled by default), since I couldn't get it to work locally, due to puppeteer CORS issues.

Instead, currently it only works when hosted from a CDN like https://www.jsdelivr.com/, so it requires internet connection (and there are some GDPR issues with enabling it by default, since jsdeliver has a privacy policy).

In order to get mermaid-mindmap working locally/offline, I think we need mermaid-js/mermaid#3710 to be merged first, then we can bundle it together into a single index.html file.

Also, to make adding mermaid-mindmap test cases easier, I've moved all of the test cases into a test/__fixtures__/... folder.

📋 Tasks

Make sure you

  • 📖 have read the contribution guidelines
  • 💻 have added unit/e2e tests (if appropriate)
  • 🔖 targeted master branch

aloisklink and others added 5 commits November 6, 2022 16:05
Bumps [mermaid](https://github.com/mermaid-js/mermaid)
from 9.1.7 to 9.2.0.
  - [Release notes](https://github.com/mermaid-js/mermaid/releases)
  - [Commits][1]

[1]: mermaid-js/mermaid@9.1.7...9.2.0

The tests needed to be modified slightly, since the following
error is now thrown for our invalid mermaid file test:

```
Error: No diagram type detected for text: ...
```

Some other features (e.g. `lazyLoadedDiagrams`) will be fixed in future
commits.

Co-authored-by: Mindaugas Laganeckas <mindaugas.laganeckas@gmail.com>
Mermaid v9.2.0 added support for custom diagrams using
`lazyLoadedDiagrams`, such as the new
[@mermaid-js/mermaid-mindmap][1] plugin diagram.

[1]: https://www.npmjs.com/package/@mermaid-js/mermaid-mindmap
Move test fixtures into a `test/__fixtures__` folder.
Previously, all of the Node.JS workflows were ignoring the
`config.json` file.
@aloisklink aloisklink added dependencies Pull requests that update a dependency file feature labels Nov 6, 2022
@github-actions github-actions bot added the chore label Nov 6, 2022
@MindaugasLaganeckas
Copy link
Member

Thank you for your help @aloisklink ! And excellent work!! Approved!

@aloisklink
Copy link
Member Author

I'm closing this, it sounds like lazyLoadedDiagrams will be removed in Mermaid v9.2.2, see mermaid-js/mermaid#3774

I might cherry-pick some commits from this branch and make another PR once the API is locked-down a bit more.

@aloisklink aloisklink closed this Nov 9, 2022
@aloisklink aloisklink deleted the chore/mermaid9.2.0 branch May 31, 2023 20:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore dependencies Pull requests that update a dependency file feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants