-
Notifications
You must be signed in to change notification settings - Fork 227
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
No charts found when space between opening code fence and language name #623
Comments
I suppose this line about not rolling your own markdown parser proved to be prophetic 😉 |
😆 The main reason we haven't switched yet is that:
However, we're planning on making a v11 release once Mermaid makes a v11 release, and we're planning on finally dropping support for Node.JS v14 & Node.JS v16. So dropping support for some more unusual Markdown implementations might be okay too. As a temporary measure, here are two remark plugins that actually use a real markdown parser that you can use:
|
Sounds like a plan! My toolchain involves function CodeBlock(elem)
local language = pandoc.utils.stringify(elem.classes)
if FORMAT:match 'gfm' and language == 'mermaid' then -- don't forget to change the markdown format here or make this more generic if needed
return {
pandoc.RawInline('markdown', '```mermaid'), -- basically just hardcode the block without the space
pandoc.RawBlock('markdown', elem.text),
pandoc.RawInline('markdown', '```')
}
end
return elem
end |
Describe the bug
When there's a space between the code fence ticks ``` and the mermaid language definition, the CLI fails to find mermaid definitions and generate images. Including the space in a client-side integration, such as GFM, accepts the space and still renders the diagram as expected.
To Reproduce
Create a markdown file with whatever Mermaid chart you wish, but instead of defining it as this:
define it like this (noting the space between the last backtick and the mermaid language definition):
and run your favourite method of generating diagrams with the CLI. It should report the error
No mermaid charts found in Markdown input
For demonstration, here is GFM rendering it with the space included:
Or indeed, with an arbitrary number of spaces, as implied by the GFM spec:
Expected behavior
CLI works like the client-side rendering (Github, Gitlab tested), and accepts spaces between the code block and the language name, so that it can be detected by the CLI and rendered appropriately alongside the other options.
Tested on both latest version of Docker image and also running via
npx
as stated in the official documentation.The text was updated successfully, but these errors were encountered: