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

Feature: allow mmdc to parse Markdown files #130

Closed
AlexanderWillner opened this issue Jun 10, 2021 · 2 comments · Fixed by #136
Closed

Feature: allow mmdc to parse Markdown files #130

AlexanderWillner opened this issue Jun 10, 2021 · 2 comments · Fixed by #136

Comments

@AlexanderWillner
Copy link

Is your feature request related to a problem? Please describe.
I'm always frustrated when editing a Mermaid diagram in VSCode in a Markdown file and I can't export it easily via CLI using mmdc.

Describe the solution you'd like
I'd like mmdc -i diagram.md to produce diagram.md.svg.

Describe alternatives you've considered
One can copy and paste the diagram to a new file without the back ticks, but this is unpleasant.

Additional context
In case more than one diagram is found in the file, multiple files could be generated.

@MindaugasLaganeckas
Copy link
Member

@knsv: do you agree with the feature described above? I see it as a great help to our users, but conceptually md files are not mmd files.

@knsv
Copy link
Contributor

knsv commented Jun 25, 2021

This makes total sense. There are some things to consider though.

I assume that the markdown file would use markdown formatting and that the diagram would come in a code chunk like this one:

```mermaid
flowchart
   A-->B
```

What do we do if, or rather when, there are multiple diagrams in the markdown file?

My take would be to:

  • When the input file is a mmd file, it should work as today
  • When the input file is a md file, the new functionality should kick in
  • Only mermaid code blocks are handled
  • When there are multiple code blocks the results will be extracted using a count creating diagram.md-1.svg ... diagram.md-1.svg

I think this would be a very strong feature. It would increase the various situations where the cli tool could be used significantly.

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.

3 participants