asciidoctor / asciidoctor-intellij-plugin

AsciiDoc plugin for products on the IntelliJ platform (IDEA, RubyMine, etc)
https://intellij-asciidoc-plugin.ahus1.de/
Apache License 2.0
345 stars 146 forks source link

Upgrade embedded Mermaid JS version to 10.3.x #1430

Closed mcbeelen closed 11 months ago

mcbeelen commented 11 months ago

Why the new feature should be added

The Mermaid Plugin for IntelliJ has updated the underlying Mermaid.js version to 10.3.1 While editing .mmd-files I see the result for some diagrams.

This Asciidoctor-Intellij-Plugin still uses version 9.2.2, which sometimes causes:

Syntax error in graph
mermaid version 9.2.2

How the new feature should work

The plugin should be able to render

[mermaid]
----
include::partial$some-diagram-with-10.y.z-syntax.mmd[]
----
mcbeelen commented 11 months ago

I'm trying to create a MR to solve this, but have some questions about how to build the included mermaid.esm.min.mjs-file.

The content of the file currently in this project is rather different from the file on unpkg.com

Should we include everything from the Mermaid Dist

@ahus1

When you added built-in Mermaid support in 4bfcf96a77952, you pushed a file mermaid.esm.min.mjs. Where did you manage to download / generate that file?

ahus1 commented 11 months ago

Hi @mcbeelen - Thank you for letting me know that there is an update.

That old version of Mermaid 9 has a monolithic file mermaid.esm.min.mjs which included everything. Looking at the current release, it seems that this has been split into smaller modules files. The dist folder contains multiple versions like mermaid.esm.min.mjs and mermaid.esm.mjs which reference different versions of each module.

The two files that are still monolithic are mermaid.min.js and mermaid.js, so it is simpler to pick mermaid.min.js instead.

I just pushed a commit that includes the update. Please let me know you would like to see a pre-release to try it, or if you want to build it yourself.

If you could post a small sample diagram here, this would be helpful for me so I can test before/after the upgrade. I tested a Sankey diagram which is only available in 10.3+, and it seems to work.

ahus1 commented 11 months ago

There is now pre-release 0.39.5 which includes my fixes. Please give it a try when you have the time.

The pre-release of the plugin is available from GitHub releases and the IntelliJ AsciiDoc EAP repository.

mcbeelen commented 11 months ago

Hi @ahus1 ,

Thank you for effort. I installed v0.39.5 from the EAP-repository and the diagram do get rendered now.

To verify that the issue is fixed I used the following Gist: AsciiDoc with mermaid block containing v10 syntax to demonstrate #1430 is fixed

mcbeelen commented 11 months ago

proof-of-fix-for-1430