DocBlox Plugin For Sublime Text 2

Posted on by benmatselby

It seems that the editor of the moment is Sublime Text 2 and sadly I have to tip my hat to Gary Rockett for showing it off to me one day.. Since that day, I’ve been a 100% convert. I started to create snippets for our internal codebase at work, as I was fed up of searching for examples for common tasks I could never remember to do, but then I saw this tweet from Stuart Herbert about creating general PHP snippets.

One thing led to another and Stuart set the pace by creating:

  • https://github.com/stuartherbert/sublime-phpunit
  • https://github.com/stuartherbert/sublime-phpsnippets

These are fantastic plugins which I recommend you install. So, I decided to peak into the PHPUnit one to see if I could create a DocBlox Plugin. It turns out you have to write Plugins in Python, which is interesting, since I know very little python. There seemed to be enough code there to get me going, so I now have a working DocBlox Plugin.

Once installed, you simply right click in the side bar menu on items you want documentation for. It can do single files and directories..

spacer

And once you click “Generate documentation…” you get the console showing the output:

spacer

You can configure where the target documentation should be published via the preferences:

spacer

and simply update the following options:

spacer

There are a few things to point out at this stage:

  • My python skills are not great!! But stick with me, I should be able to fix issues if they arise.
  • Ideally it would be great to then load the documentation in a browser, but I need to do some more reading to see how to do this on all OS’s using Python.

You can install this in one of two ways:

  • Package Control - (at time of writing 06-02-12 – there is an open pull request for this functionality)
  • Git – simply checkout the git repo into “~/Library/Application Support/Sublime Text 2/Packages/User/DocBlox” or the equivalent folder on Windows or Linux.
  • Spread the word:
  • Print
  • Email
  • Facebook
  • Reddit
  • Digg