Go in the Command Line tab of the preferences of MarkChart. Then follow the steps to enable the command line:
- Grant access to the command line tool.
- Run in the Terminal /Applications/MarkChart.app/Contents/MacOS/CLI/markchart
- Optionally create for convenience a symlink with the command cd /usr/local/bin && sudo ln -s /Applications/MarkChart.app/Contents/MacOS/CLI/markchart
MarkChart is distributed on the Mac App Store and is a sandboxed application with restricted access to the files. For the command line tool to be able to access files, you need to explicitly select a folder.
If you create the symlink for convenience, you just need to run the command markchart in a Terminal window. The MarkChart command takes a Markdown file as input and generates an PNG file as output.
Export the diagram from file.md to file.png:
markchart -i /Users/me/Desktop/file.md -o /Users/me/Desktop/file.png
markchart -i ~/Desktop/file.md
markchart -i ~/Desktop/file.md -o ~/Desktop/file.png
Export the diagram from file.md to the folder ‘folder’:
markchart -i /Users/me/Desktop/file.md -o /Users/me/Desktop/folder/
Export the diagram to PDF:
markchart -i /Users/me/Desktop/file.md -f pdf -o /Users/me/Desktop/file.pdf
Export the diagram to SVG:
markchart -i /Users/me/Desktop/file.md -f svg -o /Users/me/Desktop/file.svg
Export the diagram by adjusting the margins:
markchart -i /Users/me/Desktop/file.md -o /Users/me/Desktop/folder/ -margin-left 30 -margin-top 30 -margin-right 30 -margin-bottom 20