MooTools Docset for Dash

I am a big fan of Dash, a Mac App that indexes documentation (docsets) for offline use and stores snippets that can be expanded in just about any code editor. I recently wanted to play with the MooTools JavaScript framework while traveling without an internet connection, but I could not find a Dash docset for it. Fortunately, creating a custom docset is fairly easy, but I ran into one small problem: MooTools keeps its documentation in Markdown format (which is then compiled into HTML by a PHP script on the documentation section of the site).

Update: Dash now has its own MooTools docset available for download, so this custom docset is no longer necessary.

To get an offline HTML version of the MooTools documentation, I used a fancy wget 1 terminal command:

wget --random-wait -E -r -p -k -e robots=off -nH \
-U mozilla --cut-dirs=1 \
-I /assets,/docs/core,/docs/more

The resulting HTML files needed to be cleaned a little, but the “site” was navigable offline. Next I extracted an index from the markdown headers and their anchors, converted it to a CSV file, and then imported that into the SQLite index:

sqlite> .separator ","
sqlite> .import mootools-core-api.csv searchIndex
sqlite> .import mootools-more-api.csv searchIndex

The result,

  1. Mac users will have to install wget using Homebrew or another source. ↩︎