Comments (18)
In my current project/platform we are striving to achieve CI/CD workflow detached from public Internet.
In order to achieve it, we do the following:
- store some 3rd party dependecies either in our controlled repository server (e.g., Nexus)
- store some 3rd party dependencies in our controlled storage (e.g., AWS S3)
- store some 3rd party dependencies in the same repository as documentation's code
If mermaid
library can be configured to be stored in the same repo as documentation's code, that would fit no. 3 :).
from mkdocs-mermaid2-plugin.
Thanks, it totally makes sense.
from mkdocs-mermaid2-plugin.
Thanks. I have re-read documentation and the following trick worked for me:
- download specific version of mermaid JS to the following location:
docs/javascripts/mermaid/10.1.0/dist/mermaid.esm.min.mjs
- refer to it in my mkdocs.yaml configuration file:
extra_javascript:
- javascripts/mermaid/10.1.0/dist/mermaid.esm.min.mjs
from mkdocs-mermaid2-plugin.
Hi,
The issue is that the Mermaid library is fetched from the internet, I would like it to be versioned along the documentation (c.f. @volphy scenario #3).
Sources:
-
https://github.com/fralau/mkdocs-mermaid2-plugin/blob/master/webdoc/docs/index.md?plain=1#L237-L239
You may, however, specify your own call, with the use of the
extra_javascript
directive in the configuration file. This is considered as a hack, if the default procedure doesn't work. -
https://github.com/fralau/mkdocs-mermaid2-plugin/blob/master/mermaid2/plugin.py#L104
if libname(lib) == 'mermaid': return lib
from mkdocs-mermaid2-plugin.
I would rather keep versioning information.
from mkdocs-mermaid2-plugin.
As mentioned in the first message, using extra_javascript
would include the library in all the pages, which is not desirable.
I would like the plugin to keep selectively inject the library, but from a local directory.
from mkdocs-mermaid2-plugin.
You are right. Using the following JavaScript file works:
https://github.com/fralau/mkdocs-mermaid2-plugin/blob/master/test/extra_javascript/docs/js/mermaid.min.js
👍
Is it possible to use any version of mermaid JS:
https://github.com/mermaid-js/mermaid/tree/v10.1.0
?
If yes, how can I do it?
from mkdocs-mermaid2-plugin.
Looks good, thanks for the work!
If it works on your side, could you please release a new version and close this issue?
from mkdocs-mermaid2-plugin.
It works for me with the file from the following location:
https://cdn.jsdelivr.net/npm/[email protected]/dist/mermaid.min.js
Thanks.
from mkdocs-mermaid2-plugin.
🚀 Published in release 1.1.0 on Pypi.
from mkdocs-mermaid2-plugin.
Thank you for your contribution! This is very appreciated.
from mkdocs-mermaid2-plugin.
Thanks and I can see more or less the requirement but I would need more information.
Could you also tell me more about the exact problem you are facing with the current situation, and why an off-line load of the library would be the solution for you?
Could I also ask you to provide links for the following statements:
- "The documentation states that including a local version of mermaid is a hack"
- "The plugin didn’t silently drop libraries that do not contain \bmermaid\b in their base name. "
Thanks.
from mkdocs-mermaid2-plugin.
Excellent, and thanks for the additional info. Wouldn't it be better to remove the subdirectories?
extra_javascript:
- javascripts/mermaid.esm.min.mjs
Unless you want to keep the various versions?
from mkdocs-mermaid2-plugin.
Sure. As soon as the library is improved, I will improve my configuration.
from mkdocs-mermaid2-plugin.
Good. I have created an experimental version 1.0.9 on Github.
Example:
plugins:
- search
- mermaid2:
javascript: js/mermaid.min.js
-
If the parameter
javascript
is present (either a URL or a local pathname, relative to the docs directory), then it is used, no questions asked. -
Otherwise the plugin will look at the parameter
version
and look for the online version of the javascript library. In the presence ofjavascript
thisversion
parameter is ignored (I suppose you can use it for documentation). -
If no argument is provided, it will use the
MERMAID_LIB_VERSION
specified in the plugin.
It is still possible to use the extra_javascript
mechanism (which will bypass the above mechanism), but this it is now deprecated. It will detect any library with the string mermaid
in the filename.
Note I tested the local version of the mermaid.min.js
file, which is shipped with the package; you can find the test website under test\simple_local_lib
. In theory it would also work with an .mjs, but I haven't tested that (and I wouldn't know how to do install it cleanly). I have also tested the other cases (see test\extra_javascript
and test\simple
).
Could I ask you to test this and give me your feedback?
from mkdocs-mermaid2-plugin.
Unfortunately, it does not work in my use case.
My steps:
- removed previously generated HTML files (
site
) - removed all mermaid JS files apart from
mermaid.esm.min.mjs
- copied the latest files from
https://github.com/fralau/mkdocs-mermaid2-plugin/tree/master/mermaid2
to my local venv environment (overwritten) - disabled
extra_javascript
in mymkdocs.yaml
file - enabled new mkdocs-mermaid2-plugin feature:
plugins:
- mermaid2:
javascript: javascripts/mermaid/10.1.0/dist/mermaid.esm.min.mjs
- generated new HTML files:
mkdocs build --verbose
- viewed locally generated HTML files (
sites/index.html
) using IntelliJ IDEA & Google Chrome
Google Chrome Developer Tools reports the following error on all HTML pages with mermaid diagrams embedded:
Uncaught TypeError: Failed to resolve module specifier "javascripts/mermaid/10.1.0/dist/mermaid.esm.min.mjs". Relative references must start with either "/", "./", or "../".
Could you test the new feature with MJS files?
from mkdocs-mermaid2-plugin.
@volphy As mentioned in my message, the recommendation is to use the traditional, all-in-one mermaid.min.js
file, since it is still provided by the developers.
It is important to distinguish between the .js
(traditional javascript script) and the .mjs
file (entry point for the new type of ESM modules, since version 10).
if you use a .mjs
file, from a package, you will need the whole hierarchy of directories that comes with it. Deleting the other files will wreck the library.
I have never tried to make the ESM library work with mkdocs-mermaid2, but it might be possible. If you have success with that, please let us know the steps.
from mkdocs-mermaid2-plugin.
Yes, see here, e.g.:
https://cdn.jsdelivr.net/npm/[email protected]/dist/mermaid.min.js
As long as you use a valid version number, it should work (it is not guaranteed that the earliest version of 10 contain that file). The best thing is to check for yourself.
from mkdocs-mermaid2-plugin.
Related Issues (20)
- Unhandled exception when checking if URL exists HOT 5
- Add Zoom and Pan to Diagrams? (ER Diagram very tiny) HOT 5
- ZenUML: Using "Custom loader" leads to endless loops HOT 6
- Add support for mermaid gitgraph (make plugin compatible with mermaid lib > 10) HOT 2
- sequenceDiagram brokens HOT 5
- Superfences custom fence function does not seem to work HOT 14
- Cannot get theme to work on 10.2.4 HOT 3
- extra_javascript in mkdocs 1.5.0 is list of objects and no longer string HOT 5
- mkdocs build command prints deprecation warnings HOT 8
- Arguments in the config file do not work
- Tag the source HOT 3
- javascript parameter seems not to work with default configuration HOT 5
- Mermaid2 diagrams with annotations shows half the (+) button and nothing happens when you click it HOT 9
- Markdown inside of node text is not rendering HOT 2
- Local Mermaid library not found HOT 11
- Handle module style inclusion of local Mermaid v10 library HOT 10
- Rendering Mermaid diagram with Pan and Zoom ability on mkdocs pages HOT 4
- Warnings in webdoc, because of relative links HOT 4
- [doc/readthedoc.io] link error in index HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mkdocs-mermaid2-plugin.