AsciiDoc備忘録
markdown よりも便利そうなAsciiDocを個人的に使うときのメモ。
結局どっちがいいんだろ
githubとかTwitchはmarkdownだしな~
1.AsciiDocをかける環境を用意する。
こちらを参考にした
/idea-island/AsciiDocセットアップメモ
その後にやったことは #asciidoc~構築編、内部サーバを使うまで~ 
2.書く
記法、文法はここを参照。
https://takumon.github.io/asciidoc-syntax-quick-reference-japanese-translation/#_基本的な書き方
便利そう
よく使いそうなのをピックアップ
目次をつける
$ :toc: right
リンクにする
$ http://asciidoctor.org[Asciidoctor]
plantuml埋め込み 以下記法でいいはずなんだけど、プレビューがうまく動かないのでトライしてみる
code:a.adoc
plantuml,puml,svg
....
@startuml
人->ダイエット
@enduml
@startsalt
{+
This is a long
text in a textarea
.
" "
}
@endsalt
ファイルのinclude
$ include::./テスト結果/evi.log7
UTF8じゃないとincludeできないぽい?
3.結果出力
HTMLにする!
$ asciidoctor {name}.adoc
plantumlなどを埋め込むときはこちら。
$ asciidoctor -r asciidoctor-diagram hoge.adoc
asciidocをPDFで出力する
HTMLで作成する
$ asciidoctor -r asciidoctor-pdf-cjk hoge.adoc
Failed to load AsciiDoc document - source is either binary or contains invalid Unicode data
Use --trace for backtrace
上記エラーになったときはメッセージとおりUTF8にする
4.運用編
ファイル埋め込みがすごい!!!!!!!
方法
https://takumon.github.io/asciidoc-syntax-quick-reference-japanese-translation/#_ファイルのインクルード
※ブラウザプレビューだと使えないっぽいな。。
参考サイト
Asciidoctor PDF | Asciidoctor
プレビューできないとき
Failed to generate image: Failed to open TCP connection to localhost:8090 (No connection could be made because the target machine actively refused it. - connect(2) for "localhost" port 8090)
↑はサーバが起動していない
Failed to generate image: end of file reached
と表示されてプレビュー出来ないときの解決法
やっと動いているコマンドがわかった。。
$ asciidoctor -r asciidoctor-diagram -a outdir=.asciidoctor -a imagesdir=.asciidoctor -a imagesoutdir=.asciidoctor -a stylesdir=c:\Users\usrname\.vscode\extensions\asciidoctor.asciidoctor-vscode-2.8.3\media@ -a stylesheet=asciidoctor-editor.css@ -b html5 -a plantuml.render=PlantUMLServer -a plantuml-server-url=http://localhost:8090 -a env-vscode -q -B "c:\Users\usrname\go\src\github.com\p5w.new\PDBrep\docs" -o - -
#AsciiDoc
#ツール