You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Improve how mmdc handles stdin inputs.
Currently, running `mmdc` exits with an error if it cannot find
an stdin. However, it does this by checking if the stdin is a FIFO,
which is only true in some cases.
(it seems to fail on Windows and other non-bash shells).
I've changed `mmdc` to always read from stdin if there is no `--input`.
However, it prints a warning.
To suppress this warning, you can run mmdc with `--input -`.
// if an input file has been specified using '-i', it takes precedence over
34
32
// piping from stdin
@@ -84,7 +82,7 @@ async function cli () {
84
82
.addOption(newOption('-t, --theme [theme]','Theme of the chart').choices(['default','forest','dark','neutral']).default('default'))
85
83
.addOption(newOption('-w, --width [width]','Width of the page').argParser(parseCommanderInt).default(800))
86
84
.addOption(newOption('-H, --height [height]','Height of the page').argParser(parseCommanderInt).default(600))
87
-
.option('-i, --input <input>','Input mermaid file. Files ending in .md will be treated as Markdown and all charts (e.g. ```mermaid (...)```) will be extracted and generated. Required.')
85
+
.option('-i, --input <input>','Input mermaid file. Files ending in .md will be treated as Markdown and all charts (e.g. ```mermaid (...)```) will be extracted and generated. Use `-` to read from stdin.')
88
86
.option('-o, --output [output]','Output file. It should be either md, svg, png or pdf. Optional. Default: input + ".svg"')
89
87
.addOption(newOption('-e, --outputFormat [format]','Output format for the generated image.').choices(['svg','png','pdf']).default(null,'Loaded from the output file extension'))
90
88
.addOption(newOption('-b, --backgroundColor [backgroundColor]','Background color for pngs/svgs (not pdfs). Example: transparent, red, \'#F0F0F0\'.').default('white'))
0 commit comments