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

Ignore invalid diagrams in markdown instead of throwing error #543

Open
alamise opened this issue May 29, 2023 · 1 comment
Open

Ignore invalid diagrams in markdown instead of throwing error #543

alamise opened this issue May 29, 2023 · 1 comment

Comments

@alamise
Copy link

alamise commented May 29, 2023

I have a requirement: to replace the charts saved in mermaid format in a markdown file (c.md) with actual images. So, I installed mermaid-cli and executed the following command:

mmdc -i c.md -o c_1.md

It's basically working fine, but there is a small issue:
There are multiple charts in c.md, and one of them has an incorrect format.

Expected behavior:
Skip the erroneous chart and convert the charts with the correct format. The erroneous chart should retain its original code in the markdown file.

Current behavior:
Encountering an erroneous chart results in an error and the process terminates.

@aloisklink
Copy link
Member

aloisklink commented May 30, 2023

Encountering an erroneous chart results in an error and the process terminates.

In my opinion, this is expected behavior, and it's what I'd want mermaid-cli to do.

It might make sense to add an option (maybe something like --replace-invalid-mermaid) that prints a warning if a mermaid chart is invalid, something like what GitHub does:

Input

```mermaid
flowchart
  This is my example invalid diagram.
```

Output

image

Edit: By the way @alamise, I hope you don't mind, I edited your issue title! Please feel free to change it something else if you'd prefer.

@aloisklink aloisklink changed the title Resolving Error: Converting Markdown Charts with Mermaid-CLI Ignore invalid diagrams in markdown instead of throwing error May 30, 2023
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

2 participants