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

support mermaid #40

Open
xu4wang opened this issue Dec 9, 2022 · 4 comments
Open

support mermaid #40

xu4wang opened this issue Dec 9, 2022 · 4 comments

Comments

@xu4wang
Copy link

xu4wang commented Dec 9, 2022

As a software developer, I need to draw sequence diagram everyday. I am wondering is it easy to add mermaid support?

BR,Austin

Copy link
Collaborator

Tahul commented Dec 12, 2022

Hey @xu4wang ;

I think you can add Mermaid support to your Content Wind website by adding https://github.com/temando/remark-mermaid to @nuxt/content configuration.

https://content.nuxtjs.org/api/configuration#markdown

Here is a link to the guidelines about adding remark plugins!

Hope this can help :)

@xu4wang
Copy link
Author

xu4wang commented Dec 13, 2022

@Tahul thanks for you help.

Do you mind share me a working nuxt configuration?

Below is my version:

export default defineNuxtConfig({
  extends: 'content-wind',
  content: {
    documentDriven: true,
    highlight: {
      theme: {
        dark: 'github-dark',
        default: 'github-light'
      }
    },
    markdown: {
      // Object syntax can be used to override default options
      remarkPlugins: {
        // Override remark-emoji options
        'remark-emoji': {
          emoticon: true
        },
        // Disable remark-gfm
        'remark-gfm': false,
        //add mermaid
        'remark-mermaid': {
        },
        // Add remark-oembed
        'remark-oembed': {
          // Options
        }
      },
      // Array syntax can be used to add plugins
      rehypePlugins: [
        'rehype-figure'
      ]
    }
  }
})

I did install

$ npm install remark-mermaid mermaid.cli

However, when I use mermaid in the markdown file:

```mermaid
graph LR
Start --> Stop
```

The graph was not generated, instead it shows the mermaid source in a code block.

@ytsurk
Copy link

ytsurk commented Feb 1, 2023

Install instructions from say https://www.npmjs.com/package/remark-mermaid, you should install mermaid.cli too.

@xu4wang
Copy link
Author

xu4wang commented Feb 2, 2023

Install instructions from say https://www.npmjs.com/package/remark-mermaid, you should install mermaid.cli too.

thanks for the reply. are you able to render mermaid diagram? I did install mermaid.cli

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

3 participants