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

Mermaid (gatsby-remark) doesn't seem to work #50

Open
wserr opened this issue Jan 5, 2020 · 4 comments
Open

Mermaid (gatsby-remark) doesn't seem to work #50

wserr opened this issue Jan 5, 2020 · 4 comments

Comments

@wserr
Copy link

wserr commented Jan 5, 2020

Hi,

I am trying to use Mermaid to make graphs in my markdown files. I followed the instructions on the gatsby plugin site but it doesn't seem to work.

I tried to add the following to a markdown page:

```mermaid
classDiagram
Notification<|--User
Notification<|--Recurrence
User : int UserID()
Notification : int NotificationID()
Notification : int UserID()
Notification : string Message()
Notification : int RecurrenceID()
Notification : int Interval()
Notification : date StartingDate()
Recurrence : int RecurrenceID()
Recurrence : string Message()

But I didn't get the graph in my page. I only got a codeblock with the text in it.

I suspect I did something wrong in the gatsby.config.js but I can't put my finger on it.

Could you help me?

@praveenweb
Copy link
Member

Hi @wserr - You don't need to use gatsby-transformer-remark when gatsby-plugin-mdx is used to parse markdown already. The config can be updated to specifically just use gatsby-remark-mermaid plugin.

Here's a sample config that you can try:

{
    resolve: 'gatsby-plugin-mdx',
    options: {
      gatsbyRemarkPlugins: [
      {
        resolve: 'gatsby-remark-mermaid',
      },
      {
          resolve: "gatsby-remark-images",
          options: {
            maxWidth: 1035,
            sizeByPixelDensity: true
          }
        },
        {
          resolve: 'gatsby-remark-copy-linked-files'
        }
      ],
      extensions: [".mdx", ".md"]
    }
  }

@wserr
Copy link
Author

wserr commented Jan 6, 2020

I modified the gatsby-config.js as you stated. I then tried to add a mermaid graph to a page.

When I try this, I get the following error when loading this page:

The GraphQL query from /home/willem/homebrew/Docs/src/templates/docs.js failed.

Errors:
  Failed to launch chrome!
/home/willem/homebrew/Docs/node_modules/puppeteer/.local-chromium/linux-686378/chrome-

linux/chrome: error while loading shared libraries: libX11-xcb.so.1: 
cannot open shared object file: No such file or directory

This is a screenshot from the error in my browser:
image

@AndreyNikiforov
Copy link

@wserr If you are running in docker, you'll need to provide special care for puppeteer as described here

@Cygra
Copy link

Cygra commented May 8, 2022

Ran into this issue as well, my gatsby-remark-mermaid doesn't seem to work at the beginning.

In my circumstance, the solution is to move gatsby-remark-mermaid to the first place of all the plugins under gatsby-transformer-remark. The order seems to have effect.

Screen Shot 2022-05-08 at 18 06 59

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

4 participants