mermaid V10 support #32

Closed
opened 2023-03-03 06:40:56 +00:00 by suda-morris · 6 comments
suda-morris commented 2023-03-03 06:40:56 +00:00 (Migrated from github.com)

According to https://github.com/mermaid-js/mermaid/releases/tag/v10.0.0 mermaid has dropped the CJS support.

According to https://github.com/mermaid-js/mermaid/releases/tag/v10.0.0 mermaid has dropped the CJS support.
friegger commented 2023-07-27 07:07:20 +00:00 (Migrated from github.com)

Any update on this? Would it be an option to also allow downloading the latest or a specific version of mermaid when executing mdbook-mermaid install. Then it would not be necessary to touch mdbook-mermaid every time a new mermaid release is available.

Any update on this? Would it be an option to also allow downloading the latest or a specific version of mermaid when executing `mdbook-mermaid install`. Then it would not be necessary to touch mdbook-mermaid every time a new mermaid release is available.
badboy commented 2023-07-29 11:18:31 +00:00 (Migrated from github.com)

mdbook-mermaid install is a convenience command to drop the required files into your folder. If you need a different, more recent version you can do that by downloadig it manually and putting the files in the right place.

I won't add more complex code for arbitrary downloads.
I didn't have time to update to v10 yet and currently it's not a priority for me.

`mdbook-mermaid install` is a convenience command to drop the required files into your folder. If you need a different, more recent version you can do that by downloadig it manually and putting the files in the right place. I won't add more complex code for arbitrary downloads. I didn't have time to update to v10 yet and currently it's not a priority for me.
char101 commented 2023-08-17 07:39:17 +00:00 (Migrated from github.com)

It's easy to add mermaid-js v10 manually

  1. Remove additional-js = ["mermaid.min.js", "mermaid-init.js"] from book.toml
  2. Create theme/head.hbs containing
<script type="module">
  import mermaid from 'https://cdn.jsdelivr.net/npm/mermaid@10/dist/mermaid.esm.min.mjs';
  mermaid.initialize({ startOnLoad: true });
</script>
It's easy to add mermaid-js v10 manually 1. Remove `additional-js = ["mermaid.min.js", "mermaid-init.js"]` from `book.toml` 2. Create `theme/head.hbs` containing ```html <script type="module"> import mermaid from 'https://cdn.jsdelivr.net/npm/mermaid@10/dist/mermaid.esm.min.mjs'; mermaid.initialize({ startOnLoad: true }); </script> ```
yatesco commented 2023-09-14 10:07:42 +00:00 (Migrated from github.com)

theme/head.hbs is relative to the project root (so theme is a sibling of src). This is just a note for those like me who stupidly added it to the transient 'book' directory and wondered why it kept disappearing ;-)

Works really well - thanks @char101

`theme/head.hbs` is relative to the project root (so `theme` is a sibling of `src`). This is just a note for those like me who stupidly added it to the transient 'book' directory and wondered why it kept disappearing ;-) Works really well - thanks @char101
tetsushiawano commented 2023-11-09 07:52:21 +00:00 (Migrated from github.com)

for me, this solution works on github pages, but when do print, it can not use the V10.

for me, this solution works on github pages, but when do print, it can not use the V10.
NTmatter commented 2023-12-12 17:34:47 +00:00 (Migrated from github.com)

From a quick bit of playing, it seems like we can overwrite the local copy of mermaid. It gets picked up and used buy the build:

curl -LO https://cdn.jsdelivr.net/npm/mermaid@10/dist/mermaid.min.js

Beware of local browser cache!

From a quick bit of playing, it seems like we can overwrite the local copy of mermaid. It gets picked up and used buy the build: ```shell curl -LO https://cdn.jsdelivr.net/npm/mermaid@10/dist/mermaid.min.js ``` Beware of local browser cache!
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
jer/mdbook-mermaid#32
No description provided.