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
Update to use remark-mermaidjs #19
Conversation
I suggest to revamp this plugin entirely using I think all that’s needed is the following code: async function gatsbyRemarkMermaid(ast, options) {
const { default: plugin } = await import('remark-mermaidjs')
const transformer = plugin(options)
return transformer(ast)
}
module.exports = gatsbyRemarkMermaid Could you give that a try? Technically the transformer takes a second argument |
@remcohaszing: Take a look. Using
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! This looks really great!
I just have a few nit picks.
Co-authored-by: Remco Haszing <remcohaszing@gmail.com>
@remcohaszing: Great review! It's a true pleasure to work with someone who pays attention to detail! |
Awesome! Thank you! ❤️ |
Thanks, @remcohaszing! I look forward to working with you more in the future! |
Aww thanks! I’m sure we will if you stay around in the remark / MDX ecosystem. :) |
Description
This PR provides the following updates:
index.js
to import and useremark-mermaidjs
.package.json
to addremark-mermaidjs
as the only dependency.README
docs to describe all the updates.How to test this PR
git clone https://github.com/bdenham/mdx-starter.git
cd mdx-starter
git checkout
remark-mermaidjs-test`yarn install
yarn dev
base
theme: Flowchart, Sequence, Gantt, Class, State, Pie Chart, Git Graph, User Journey, and Entity Relationship.{"theme": "base"}
.gatsby-config.js
file.src/pages/mermaid.mdx
.Other testing details
Updates to the package were manually tested in both Gatsby v4 and v5 projects:
In both projects, I used yalc to test my local package changes to ensure I could successfully render the same markdown file (see below) containing all the currently supported mermaid diagrams.
Gatsby v5 MDX starter project
See instructions above to run this test.
The test markdown file was added to the Gatsby v5 starter project using both
.md
and.mdx
extensions. All diagrams rendered correctly, matching the output shown on https://mermaid.live/. All plugin options worked as designed using the following configuration:Gatsby v4.24 theme project
The test markdown file was added to the Gatsby v4.24 example project within the theme's monorepo. All diagrams rendered correctly, matching the output shown on https://mermaid.live/. All plugin options worked as designed using the same configuration noted above.
Markdown Test File
MARKDOWN TEST FILE — Edit this description to copy it.
Mermaid Tests
This is a test page for mermaid diagrams.
Flowchart
Sequence Diagrams
From Live Editor
With loop
Gantt Diagram
Class Diagram
State Diagram
Pie Chart
Git Graph
User Journey
Entity Relationship Diagram
Closes #5
Closes #6
Closes #15
Closes #17