niszetの日記

細かい情報を載せていくブログ

(Pandoc)Pandoc内では`--to asciidoc`と`--to asciidoctor`が区別されている件

そういえばそんなこともあったわね…。

先の記事に書いた通り、Pandocは拡張子を見ているんですが、asciidoctorにはならないようです。

しかし、この形式たちは内部で差異があり、出力ファイルの文法が異なるので注意です。ていうかasciidoctorの方が標準でいいんじゃねーのかコレ…。

ということでざっとコード読む。対象はコレ。

github.com

差異はinlineだけっぽいので適当にコード例を書いて、あとは見てくれ~の流れ。

入力ファイルはこんな感じで準備。

DoubleQuote of \"text\" is converted to "text"

SingleQuote of \'text\' is converted to 'text'

Code of \`a+b\` is converted to `a+b`

InlineMath of \$a + b\$ is converted to $a + b$

DisplayMath of \$\$a * b\$\$ is converted to $$ a * b $$

asciidocの場合。これは拡張子が.adocなら勝手に判断される。今回は標準出力に表示したので--toでの指定が必須(そらそう)

pandoc input.md --to asciidoc
DoubleQuote of "text" is converted to ``text''

SingleQuote of 'text' is converted to `text'

Code of `a+b` is converted to `a+b`

InlineMath of $a + b$ is converted to latexmath:[$a + b$]

DisplayMath of $$a * b$$ is converted to

[latexmath]
++++
\[ a * b \]
++++

次。asciidoctorの場合。

pandoc input.md --to asciidoctor
DoubleQuote of "text" is converted to "`text`"

SingleQuote of 'text' is converted to '`text`'

Code of `a+b` is converted to `+a+b+`

InlineMath of $a + b$ is converted to latexmath:[a + b]

DisplayMath of $$a * b$$ is converted to

[latexmath]
++++
 a * b
++++

おわかりだろうか。私はAsciiDoc形式に詳しくないのでどう使い分けるのかわからないですが、コレの差が効いてくることもあるのでしょう。知っておくと良いかもしれません。