-
Notifications
You must be signed in to change notification settings - Fork 3
Description
Implementation PR
No response
Reference Issues
No response
Summary
We've added the latest mermaid.js with django-mermaid to my work's product docs project - thank you again for making this so easy!
In its AppConfig.ready, django-mermaid tries to download the specified version of mermaid.js if a custom version was specified. This is downloaded into django-mermaids static folder.
This will not work for all deployment scenarios. By the time AppConfig.ready has run, collectstatic could already have been executed. In scenarios where static files are pushed to S3, we might never find the downloaded mermaid.js. In our corporate environment, the site packages directory is write-protected, so this approach doesn't work at all.
There are a few ways this could be improved (e.g. making the download directory customizable, downloading and using media files instead). But I am not a fan of side effects in AppConfig.ready, and I think there is an even simpler approach: be able to opt-in to using the CDN-hosted version of mermaid.js instead of via staticfiles.
Adding this feature presumably also would've addressed #8.
I am afraid I got moved to a different project, so likely won't be able to make a pull request this time.
Basic Example
A get_mermaid_uri could replace this, and we already have the logic to build the CDN URL.
Drawbacks
None, apart from the added complexity of one more settings variable.
Unresolved questions
No response