Markdownよりかなり多機能に見えますね。 最近はMarkdownが人気になっている軽量マークアップ言語ですが、選択肢は一つではありません。reStructuredText、textile、RDocなど様々な言語があります。それぞれに特徴があり、記法も異なるので手に馴染むものがどれか色々試してみると良いでしょう。 今回はその一つ、AsciiDocを紹介します。DocBookやPDF、ePub、LaTeXなどへのエクスポートをサポートした多彩な記法となっています。

AsciiDocの使い方

記法としては基本的に以下のようになります。

Wikipediaより拝借。

Markdownとも同じような感じで、見やすい書き方ができるようです。なお、以下のような形でメタを埋め込む事もできるようです。

AsciiDoc User Guide
===================
Stuart Rackham <srackham @gmail.com>
:Author Initials: SJR
:toc:
:icons:
:numbered:
:website: http://asciidoc.org/

Markdownでは拡張版でサポートされているのみなので、メタが埋め込めるのは便利そうです。ちなみにAsciiDocの色々な機能を使ったと思われるユーザガイドは、元がこちらで、HTML変換版はこちらです。

見出しがついたサイドバーブロックなる機能は、

.This document
**********************************************************************
This is an overly large document, it probably needs to be refactored
into a Tutorial, Quick Reference and Formal Reference.

If you're new to AsciiDoc read this section and the < <X6,Getting
Started>> section and take a look at the example AsciiDoc (`*.txt`)
source files in the distribution `doc` directory.
**********************************************************************

のように書くと次のように変換されます。

サイドバーブロックの例です。

定義リストも使えます。

Book::
  The `./doc/book.txt` file in the AsciiDoc distribution.

Multi-part book::
  The `./doc/book-multi.txt` file in the AsciiDoc distribution.

自動でアイコン埋め込みも可能で、

TIP: Use the `--verbose` command-line option to view executed
toolchain commands.

のように書くと次のように変換されます。

変換後です。左側にアイコンが追加されています。

えてして複雑になりがちなテーブルは次のように書きます。

[cols="3*",frame="topbot",options="header"]
|====================================================================
|'stylesdir' attribute
|Linked location ('linkcss' attribute defined)
|Embedded location ('linkcss' attribute undefined)

|Undefined (default).
|Same directory as the output document.
|`stylesheets` subdirectory in the AsciiDoc configuration directory
(the directory containing the backend conf file).

|Absolute or relative directory name.
|Absolute or relative to the output document.
|Absolute or relative to the AsciiDoc configuration directory (the
directory containing the backend conf file).

|====================================================================

表現力が多彩な分、かなり複雑ですね…

プラグインによる拡張にも対応しており、コミュニティベースで幾つも開発されています。Markdownはその手の拡張性が弱いように感じるので大きな利点かも知れません。

Windowsにはバイナリも配布されていますし、Mac OSXであればHomebrewなどで簡単にインストールできます。Markdownが手に馴染まない…という方は一度試してみても良いのではないでしょうか。

AsciiDocはPython製のオープンソース・ソフトウェア(GPL)です。

asciidoc - Text based documentation - Google Project Hosting