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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Markdown parsing, add more verbose output #165

Merged
merged 3 commits into from
Sep 23, 2021

Conversation

ghtyrant
Copy link
Contributor

@ghtyrant ghtyrant commented Sep 21, 2021

馃搼 Summary

  • Fix exception in case no charts were found in Markdown file
  • Log depending on type of input (Markdown or mermaid): Number of charts
    found in Markdown file
  • Add --quiet flag to suppress these new log message

String.match returns null if nothing was matched - the PR fixes handling this case.
Also adds more log output that can be suppressed with -q/--quiet.
Explains in description for --input flag how .md files are treated.

Resolves #160

馃搹 Design Decisions

Calling mermaid-cli on a Markdown file that does not contain mermaid charts should not crash the application. Neither should it report an error or return a non-null status code as it might break use cases where someone blindly runs it on a collection of Markdown files.
I did not apply the standard.js linter/formatter as the existing code base is not formatted either.
--quiet suppresses info but not error messages - not sure if that is desired behavior.

馃搵 Tasks

Make sure you

  • 馃摉 have read the contribution guidelines
  • 馃捇 have added unit/e2e tests (if appropriate)
  • 馃敄 targeted master branch

- Fix exception in case no charts were found in Markdown file
- Log depending on type of input (Markdown or mermaid): Number of charts
  found in Markdown file
- Add --quiet flag to suppress these new log message
@MindaugasLaganeckas
Copy link
Member

Thanks for the PR. I will look into it this week (hopefully today). 馃槃

@MindaugasLaganeckas MindaugasLaganeckas merged commit ccf75a8 into mermaid-js:master Sep 23, 2021
ghtyrant added a commit to ghtyrant/mermaid-cli that referenced this pull request Sep 28, 2021
@ghtyrant ghtyrant mentioned this pull request Sep 28, 2021
3 tasks
MindaugasLaganeckas pushed a commit that referenced this pull request Sep 29, 2021
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 this pull request may close these issues.

Provide better error message for .md files not containing valid Markdown
2 participants