Topic on Extension talk:Mermaid

Update mermaid.min.js to Version 10.x

5
Ac-fra (talkcontribs)

We are using Mediawiki 1.36 with Mermaid Extension 3.1.0, which includes Mermaid 8.14.0.


An update with jarn install did not update mermaid.min.js to newer versions.

A manual update of mermaid.min.js to Version 10.4 failed, since the JavaScript could not be loaded.


Is there a practicable way to update the included version of mermaid.min.js to current version 10.x?

Mikasa7 (talkcontribs)

Hello.

Try to use the mermaid.js file instead of mermaid.min.js. Also the variable $wgResourceLoaderDebug = true; solves the problem (but this is not so much a solution as the reason why it happens).

Tom-Wiming (talkcontribs)

@Mikasa7, can you please provide a step-by-step instruction for dummies how to upgrade to Mermaid 10.x? Would be greatly appreciated!

Or could somebody who knows how to do it create a new version of the Extension with the latest Mermaid version included?

Mikasa7 (talkcontribs)

Hello @Tom-Wiming,

To update version of mermaid.js you need to clone repository: https://github.com/SemanticMediaWiki/Mermaid

Execute the commands:

  • npx npm-check-updates -u (or manually edit package.json - change the mermaid version to the new one)
  • npm install

At execution time there may be errors related to file copying, but this is OK.

The updated version of the file will be located at:

resources/mermaid.min.js

If MediaWiki cannot load new version of the file correctly replace in extension.json row resources/mermaid.min.js with resources/mermaid.js

Afterwards you should copy file node_modules/mermaid/dist/mermaid.js to resources folder.

I hope I've been helpful

Tom-Wiming (talkcontribs)

Thanks @Mikasa7! I indeed got the copying error messages, but ignored them. Also, it didn't work with "mermaid.min.js" (the code threw an exception in the browser), but using the unpacked "mermaid.js" works.

Reply to "Update mermaid.min.js to Version 10.x"