mermaid-js / mermaid-cli

Command line tool for the Mermaid library
MIT License
2.48k stars 234 forks source link

File naming not correct when generating png images for multiple .md files #425

Closed hartmanjan1970 closed 1 year ago

hartmanjan1970 commented 1 year ago

My goal is to automate generation of images from the diagrams. If i use mmdc -e png -i ./site/mermaid/*.md Then for all .md files in the folder the images are generated content wise correctly as png but the file is called myfile.md-1.svg Is there some other way to get this working or is this a bug?

secondly i have a question for output file placement: Is there a way to define an output folder to place the generated images?

thanks

aloisklink commented 1 year ago

My goal is to automate generation of images from the diagrams. If i use mmdc -e png -i ./site/mermaid/*.md Then for all .md files in the folder the images are generated content wise correctly as png but the file is called myfile.md-1.svg Is there some other way to get this working or is this a bug?

~Duplicate of https://github.com/mermaid-js/mermaid-cli/issues/394~ _Edit: _Ah, it looks like @GitHub doesn't understand this unless it's in a comment by itself.

It is a bug. It's been fixed on the master branch, but it hasn't yet been officially published. This project tries to follow the main mermaid version numbering scheme, so we try to bundle minor bug-fixes/features with mermaid updates. There's just recently been a mermaid release, so there will probably be a new mermaid-cli release very soon!

secondly i have a question for output file placement: Is there a way to define an output folder to place the generated images?

I believe they're put in the same folder as the generated markdown file, so you can decide that by adding --output ./my/directory/structure/my-output-file.md and your output should appear as:

If you mean that you want them in a separate directory from the markdown file, that's currently not supported, but you're welcome to make a new GitHub Issue as a feature request.

You may find other mermaid markdown-renderer specific plugins like https://github.com/raghur/mermaid-filter more useful, as this project tries not to use syntax specific to a single Markdown renderer, unlike other projects.

aloisklink commented 1 year ago

Duplicate of https://github.com/mermaid-js/mermaid-cli/issues/394