15d23
2/21/2017 - 10:12 AM

Graphviz (DOT) Build System for Sublime Text 2 and 3

Graphviz (DOT) Build System for Sublime Text 2 and 3

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"
}

Usage

  • 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.

Installation

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).

Troubleshooting

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