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

Provide better error message for .md files not containing valid Markdown #160

Closed
ghtyrant opened this issue Sep 17, 2021 · 2 comments · Fixed by #165
Closed

Provide better error message for .md files not containing valid Markdown #160

ghtyrant opened this issue Sep 17, 2021 · 2 comments · Fixed by #165

Comments

@ghtyrant
Copy link
Contributor

Is your feature request related to a problem? Please describe.
I just tried mmdc for the first time, copy-pasted a sequence diagram example from the mermaid documentation and out of habit named my input file test.md.
Running mmdc as follows:
mmdc -i test.md -o test.svg -t dark -b transparent
yields the following output

/usr/lib/node_modules/@mermaid-js/mermaid-cli/index.bundle.js:210
    if (matches.length > 0) {
                ^

TypeError: Cannot read properties of null (reading 'length')
    at /usr/lib/node_modules/@mermaid-js/mermaid-cli/index.bundle.js:210:17
    at Generator.next (<anonymous>)
    at step (/usr/lib/node_modules/@mermaid-js/mermaid-cli/index.bundle.js:4:191)
    at /usr/lib/node_modules/@mermaid-js/mermaid-cli/index.bundle.js:4:361

Describe the solution you'd like
A more descriptive error message, e.g. "Input file expected to contain valid Markdown. Don't use the file extension .md if you just want to render a mermaid diagram." or probably something less clunky would be helpful.

@MindaugasLaganeckas
Copy link
Member

@ghtyrant : Thanks for reporting the issue! Would you like to work on the solution? I would be glad to review your PR 😄

@ghtyrant
Copy link
Contributor Author

@MindaugasLaganeckas Done 🙂

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

Successfully merging a pull request may close this issue.

2 participants