In Praise Of AsciiDoc

For anyone who does not know what AsciiDoc is, it is a documentation generation system that translates plain text files to a variety of formats. For most of my uses it is used to store plain text documentation and generate the html counterpart for online viewing.

The markup is fairly simple and it looks quite nice when viewed in its unprocessed form. It is also a dumb system, which is an underapreciated feature in many crowds. The backend generation code is composed of simplistic templates and for more complicated cases it outputs docbook, which is a nice intermediate format IMO, but a wreched master format due to its sheer verbosity.

Why post this?

Well, I just rebuilt the main portion of my website via asciidoc renderings of README's and user guides. I personally think it looked quite nice, so I just removed the standard RedCloth generator that enki started with and I replaced it with asciidoc.

This amounted to just calling asciidoc when enki formats each page. This was a fairly trivial modification along the lines of

  1 class EnkiFormatter
  2   class << self
  3     def format_as_xhtml(text)
  4       IO.popen(ASCIIDOC_COMMAND, "w+") do |pipe|
  5         pipe.puts text
  6         pipe.close_write
  7         pipe.read
  8       end
  9     end
 10   end
 11 end
-----------------------

The css on this site is likely to change somewhat to enable some of the nice defaults of asciidoc.
Now for some quick tests to verify that things look sane:

.Ordered
. number
. number
  .. letter
  .. letter
. number
.. loweralpha
.. loweralpha
... lowerroman
... lowerroman
.... upperalpha
.... upperalpha
..... upperroman
..... upperroman
.... upperalpha
... lowerroman
.. loweralpha
. number

normal, _italic_, *bold*, +mono+.

``double quoted'', `single quoted'.

normal, ^super^, ~sub~.

.Sidebar Title
****
*Sidebar* Block

some sidebar block text
****

.Quote Title
[quote, cite author, cite source]
____
*Quote* Block

Some quote text
____