Next post: Blinkbeat

LnzScript Documentation Viewer

I wrote a little documentation viewer that displays documentation information in a tree control.


I spent a lot of time going through the Python library documentation, acquiring what I thought was important, and re-organizing all of the modules into my own categories. This also required writing Python scripts to turn reStructuredText, the loose and readable format of the Python documentation, into the xml format used by the doc viewer.

I also organized all of the documentation for C.

One cool feature is that it can communicate with the SciTE code editor. So, when run from LnzScite, it appears like a tool window, and you can double-click a function in the browser, which will insert the function's name into the editor. (Watch for this in Launchorz 0.3). A planned feature is to be able to look up documentation on the currently selected function.

I wanted this program to feel small and lightweight, so I did this: the nodes are created dynamically, from the xml, when you expand a parent node. This means that the entire documentation isn't loaded into memory and no unneeded TreeNodes are created. I also spent time tuning the xml-parsing code to be very fast, using C#'s stream reader which avoids DOM overhead.

You can download the Lnz Doc Viewer, which includes documentation for C, Python, and LnzScript. The source can be found here. You can see it by downloading LnzScript, opening the LnzEditor, and going Help->Documentation Viewer.

As an aside, I'm starting to take advantage of some of the benefits of xml. In the source for Launchorz, there are special comments for the provided functions. Everything starting with /// is treated as a documentation string, and can be processed by a Python script into an xml file. This xml file contains the prototypes and docs for every function in lnzscript - and the same file is used by a c# program, a c++ program, and a wsh script. And it doesn't stop there - if you open the same xml file in a web browser, it nicely renders the documentation with xslt!