AsciiDoc is a great markup format for writing notes. In fact, almost all computer-based notes I write are in AsciiDoc; it is simple yet expressive, portable, and most importantly, grepable.
While Vim is my primary tool for viewing AsciiDoc files, looking through the raw text can leave a bit to be desired. Longing for the beautifully rendered output that only an AsciiDoc file can provide, I threw together the following simple (and ugly) Python script:
import os, sys, tempfile, webbrowser tmpf = tempfile.mktemp(".html", "%s-"%(os.path.basename(sys.argv))) os.system("asciidoc -o %s %s" % (tmpf, sys.argv)) webbrowser.open(tmpf)
This script takes an AsciiDoc file path as an argument, renders it to HTML as a temporary file, then views the HTML file using the default browser. One downside to this script is that the temporary file is not automatically deleted.
If Windows happens to be your OS of choice, you can easily add this script to the Explorer context menu. Using
regedit, find the registry key of the file extension typically associated with AsciiDoc; I use
.txt but some common alternatives are
.asciidoc. Add a new static verb named "View as AsciiDoc" (or something similar) and make the command
python <PATH_TO_SCRIPT> %1. Now when right-clicking on AsciiDoc files within the Windows Explorer, you will have an option like the one show here: