Read in the diagram as a string instead of a .mmd file?
I'm using Node. I'm wondering how I can have the prorgam read in my string instead of specifying a file? I have the string in memory and would prefer to just use it directly somehow instead of writing it to a file.
I guess a way to implement is read from console stdin, GraphViz uses it.
@Schachte, if you write a Node.js program yourself, you can use the render method from mermaidAPI. It expects a string with the graph definition.
If you want to use the mmdc script with the standard input, you'd need add the support for it. For example, if -- occurs on the command line, read the graph definition from the standard input. Or even do it by default if the file name is missing, instead of printing a failure.
PR #65 introduces support for standard input and output, if input or output files are not provided. It can be used on the command line or in a shell script to echo a string with the graph definition to the mmdc script.
Development has moved to the https://github.com/mermaid-js/mermaid-cli repo, please re-open your issue there if it's still relevant.
The package has also been renamed on NPM to @mermaid-js/mermaid-cli, so you may need to run npm uninstall mermaid.cli && npm install @mermaid-js/mermaid-cli to get the latest version of this package.
@Schachte, if you write a Node.js program yourself, you can use the render method from mermaidAPI. It expects a string with the graph definition.
@mermaid-js/mermaid-cli supports a Node.JS API too, so you don't need to worry about creating a browser context or creating any files.
If you want to use the mmdc script with the standard input, you'd need add the support for it. For example, if -- occurs on the command line, read the graph definition from the standard input. Or even do it by default if the file name is missing, instead of printing a failure.
@mermaid-js/mermaid-cli currently can read inputs from standard input, but there's currently no support for writing to standard output. Pull requests are welcome though!