Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Markdown-pdf: Mermaid Server VSCode URL no longer resolves #312

Open
ajoseps opened this issue Feb 23, 2023 · 6 comments
Open

Markdown-pdf: Mermaid Server VSCode URL no longer resolves #312

ajoseps opened this issue Feb 23, 2023 · 6 comments

Comments

@ajoseps
Copy link

ajoseps commented Feb 23, 2023

The default value for the mermaid server is https://unpkg.com/mermaid/dist/mermaid.min.js. This URL resolves to https://unpkg.com/mermaid@10.0.0/dist/mermaid.min.js and does not exist. There is a https://unpkg.com/mermaid@9.0.0/dist/mermaid.min.js that exists (and works), but it seems like going forward mermaid is using a different format.

The following files exist for 10.0.0:
mermaid.core.mjs
mermaid.core.mjs.map
mermaid.d.ts
mermaid.esm.min.mjs
mermaid.esm.min.mjs.map
mermaid.esm.mjs
mermaid.esm.mjs.map
mermaid.spec.d.ts

I tried replacing the URL with the mermaid.esm.min.mjs but that did not work. I'm not a web developer so I'm not sure if it is as simple as replacing the URL with one that points to one of these files.

@mark-win
Copy link

You can load the previous Version of Mermaid, by Entering this:
https://unpkg.com/mermaid@9.4.0/dist/mermaid.min.js
Works fine for me as a workaround.

@mark-win
Copy link

Just noticed, you posted the fix already. Sorry!

@mfoulds
Copy link

mfoulds commented Mar 15, 2023

As @ajoseps suspected, in this mermaid issue they say:

As discussed above, I can confirm this has broken packages that include Mermaid via unpkg: i.e. https://unpkg.com/mermaid/dist/mermaid.min.js

JS deliver is indeed serving a cached version instead of the 404.

Swapping to https://unpkg.com/mermaid@10/dist/mermaid.esm.min.mjs resolves the issue
(or use https://unpkg.com/mermaid@9/dist/mermaid.min.js if you can't switch to ESM).

I tried setting https://unpkg.com/mermaid@10/dist/mermaid.esm.min.mjs in VSCode but it doesn't work, so changed to https://unpkg.com/mermaid@9/dist/mermaid.min.js (which I assume picks up the latest available version as @mark-win suggested.

@OlivierGuilloux
Copy link

You can used https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js

@falettinsouls
Copy link

On April 15th, 2023, I also encountered a similar issue. Mermaid was not properly exported as a PDF, and I discovered that the cause was a failure in CDN reference. 

When I visited UNPKG in browser mode, I found that the mermaid.min.js that should have been referenced as default setting was missing from https://unpkg.com/browse/mermaid@10.1.0/dist/. I reverted the version to mermaid@10.0.3-alpha.1 and applied the mermaid.min.js located there. 

However, since "/browse/" did not provide the appropriate directory specification, I had to replace it with the following URL: "https://unpkg.com/mermaid@10.0.3-alpha.1/dist/mermaid.min.js"

Finally, Markdown PDF can now successfully convert Mermaid diagrams to PDF. 

I was plagued by various minor issues such as 

    – where to change the settings, 
    – which recent version is working properly, and 
    – how to properly retrieve specific files (without being confused by URLs  such as included "/browse/" when I accessed that place by browsing mode) 

...but I managed to solve them on my own somehow.

Since I don't have the ability to contribute to the development of this useful program, I hope that the developers can modify it to reference the working js file as the default when this program is installed. Alternatively, I would appreciate it if the "Issue" section at the bottom of the program description could explicitly mention that this issue exists.

@falettinsouls
Copy link

On April 15th, 2023, I also encountered a similar issue. Mermaid was not properly exported as a PDF, and I discovered that the cause was a failure in CDN reference.

When I visited UNPKG in browser mode, I found that the mermaid.min.js that should have been referenced as default setting was missing from https://unpkg.com/browse/mermaid@10.1.0/dist/. I reverted the version to mermaid@10.0.3-alpha.1 and applied the mermaid.min.js located there.

However, since "/browse/" did not provide the appropriate directory specification, I had to replace it with the following URL:

"https://unpkg.com/mermaid@10.0.3-alpha.1/dist/mermaid.min.js"

Finally, Markdown PDF can now successfully convert Mermaid diagrams to PDF.

I was plagued by various minor issues such as

  • where to change the settings,
  • which recent version is working properly, and
  • how to properly retrieve specific files (without being confused by URLs such as included "/browse/" when I accessed that place by browsing mode)

...but I managed to solve them on my own somehow.

Since I don't have the ability to contribute to the development of this useful program, I hope that the developers can modify it to reference the working js file as the default when this program is installed. Alternatively, I would appreciate it if the "Issue" section at the bottom of the program description could explicitly mention that this issue exists.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants