Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Torenable/cc2aabcc6baa73d919419bfbd55db2f3 to your computer and use it in GitHub Desktop.
Save Torenable/cc2aabcc6baa73d919419bfbd55db2f3 to your computer and use it in GitHub Desktop.
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": [ "/usr/local/bin/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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment