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

Use code fence token mermaid instead of mermaidjs #46

Closed
joshuacurtiss opened this issue Mar 25, 2022 · 5 comments
Closed

Use code fence token mermaid instead of mermaidjs #46

joshuacurtiss opened this issue Mar 25, 2022 · 5 comments
Labels
enhancement New feature or request

Comments

@joshuacurtiss
Copy link

I've noticed that existing mermaid plugins for VuePress 1.x use the fenced code block token mermaid instead of mermaidjs. I'm just curious, is there a reason for this divergence that would cause code migrated from a VuePress 1.x environment to have these changed?

I recommend adding support to check for mermaid in addition to mermaidjs in markdown-it-mermaid.ts. Does this make sense? Let me know what you think!

@Renovamen
Copy link
Owner

Hi, please see this comment in #21:

VuePress uses Prism as default syntax highlighter, which supports language mermaid in PrismJS/prism#3050.

That means, Prism will try to render the content in a fenced code block with token mermaid as a highlighted code block. Thus if we still use token mermaid in plugin-mermaid, there will be a conflict between it and Prism.

I know this breaking change will cause inconvenience, but it's the only workaround that come to my mind.

@joshuacurtiss
Copy link
Author

Thanks, I understand. What are your thoughts on making the token settable in options, then those who desire to change it are free to do so without needing to fork or make a custom markdown-it-mermaid.ts? Thanks for your consideration! 😄

@Renovamen
Copy link
Owner

Sounds reasonable, I'll have a try.

@Renovamen
Copy link
Owner

Supported in v2.0.0-alpha.19. Now you can customize the token by:

module.exports = {
  plugins: [
    [
      "@renovamen/vuepress-plugin-mermaid", {
        token: "mermaid"
      }
    ]
  ]
}

Thanks!

@joshuacurtiss
Copy link
Author

Perfect! Thank you very much!

@Renovamen Renovamen added the enhancement New feature or request label Apr 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants