Asciidoc試してみた

markdownより表現力あって、Sphinx(ReST)以外のマークアップ方法ないかなと思ってasciidocを試してみた。

asciidocそのものはPython実装らしく、MacだとHomebrewでインストールできる(Ruby実装のasciidoctorてのもあって、こっちはgemからインストール可。


Windowsだとインストールめんどいのかなぁ」と調べていたらGradleのプラグインを発見した。
GitHub - asciidoctor/asciidoctor-gradle-plugin: A Gradle plugin that uses Asciidoctor via JRuby to process AsciiDoc source files within the project.


これ使うと、Gradleの実行環境さえあればすぐasciidoc使える事がわかった(内部で、JRubyつかってasciidoctor呼んでるみたい。


こんな build.gradleと。

buildscript {
  repositories {
    jcenter()
  }

  dependencies {
    classpath 'org.asciidoctor:asciidoctor-gradle-plugin:1.5.2'
  }
}

apply plugin: 'org.asciidoctor.convert'


asciidoctor {
  backends = [ 'html', 'html5', 'docbook' ]
  resources {
    from(sourceDir) {
      include 'images/**'
    }
  }
}

こんなディレクトリを用意する。


あとは、こんなコマンド実行すればドキュメントを生成してくれる。手軽で大変便利。

$ ./gradlew asciidoctor


asciidoc、markdownより表現力あって興味を惹かれたのだけれど、以下の部分でsphixに敵わなかった。

  • book styleの構成の作り方がわかんなかった
  • text生成が、htmlをlynxw3m使ってるので物理改行だらけで実用的じゃ無い。

そんなわけで、今度はRe:VIEWに挑戦してみる(どれもダメならsphinxに戻れば良し。