To transform the currently opened Graphviz source file (in DOT Language) into a PNG:
{
"cmd": [ "dot", "-Tpng", "-o", "$file_base_name.png", "$file"],
"selector": "source.dot"
}
- Open a Graphviz source file
- Hit
CMD-B
from your editor - Open the rendered PNG file from within Sublime (it will display it)
If you place the PNG side by side with your DOT source file, you'll see the PNG automatically refresh with each build.
Create a new build system (_Tools > Build System > New Build System...), copy and paste the above content in the editor, and save it as Graphviz.sublime-build
(should automatically go to the Packages/User
subfolder of Sublime Text).
This was tested to work on Mac OS X, Sublime Text 2 and 3. To get it work under another OS, you might need to add OS-specific options; see Build system specific options