10
8

More than 5 years have passed since last update.

CentOS-7.0 で Pandocのインストール

Last updated at Posted at 2014-11-07

はじめに

以下にインスパイアされて、CentOS-7.0で試してみたところ、ちょっとうまく行かなかったのでメモ。

あと、以下も参考にさせていただきました。

インストール

面倒なのでyumでepelで。

$ sudo yum install -y epel-release
$ sudo yum install -y pandoc

画像のパスを改変済みのgithub.cssをダウンロード

$ mkdir ~/.pandoc
$ cd ~/.pandoc
$ wget https://gist.githubusercontent.com/griffin-stewie/9755783/raw/1b8b3bf2f5364908dda36d0c1d8e9e0b21cbb84e/github.css

Pandoc公式サイトのREADMEを使ってテストしてみるとエラー

$ wget http://johnmacfarlane.net/pandoc/demo/README -O input.md
$ pandoc input.md -s --self-contained -t html5 -c github.css -o test.html
Fetching https://raw.githubusercontent.com/gollum/gollum/master/lib/gollum/public/gollum/images/para.png...
pandoc: Failed to retrieve https://raw.githubusercontent.com/gollum/gollum/master/lib/gollum/public/gollum/images/para.png
user error (https not supported)

調べてみたところどうもEPELのパッケージの問題っぽいのだけど、HTTPSでファイルがフェッチできないのが原因なのであれば、ローカルで完結させてしまえばよいのではないかということで。

github.cssで読み出されている画像を~/.pandocにダウンロード

$ cd ~/.pandoc
$ wget https://raw.githubusercontent.com/gollum/gollum/master/lib/gollum/public/gollum/images/para.png
$ wget https://raw.githubusercontent.com/gollum/gollum/master/lib/gollum/public/gollum/images/dirty-shade.png

github.css内のパスを以下のように変更

github.css
   background: url("para.png") no-repeat 10px center;
github.css
   background: transparent url("dirty-shade.png") repeat-x 0 0;

再度実行。今度はエラーなく終了。

$ pandoc input.md -s --self-contained -t html5 -c github.css -o test.html

生成されたHTMLも特に問題ないように見えます。

pandoc.png

最後に

根本的な解決にはなってませんし、Haskell Platform でインストールすればいいだけなのかもしれませんが、~/.pandocをdotfileリポジトリでまるっと管理してしまえば、それほど更新することもないでしょうしお手軽でいいかなと思ってます。

10
8
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
10
8