カメニッキ

カメとインコと釣りの人です

Mac OS X Yosemite のTerminalでMarkdownファイルをプレビューする

必要なもの

手順

  1. pandocインストール
[PMAC226S ~/work]$ brew install pandoc
  1. 標準でインストールされているgroffを入れ替え
[PMAC226S ~/work]$ brew tap homebrew/dupes
==> Tapping Homebrew/dupes
Cloning into '/usr/local/Library/Taps/homebrew/homebrew-dupes'...
remote: Counting objects: 41, done.
remote: Compressing objects: 100% (41/41), done.
remote: Total 41 (delta 0), reused 3 (delta 0), pack-reused 0
Unpacking objects: 100% (41/41), done.
Checking connectivity... done.
Tapped 38 formulae (101 files, 412K)
[PMAC226S ~/work]$ brew install groff
==> Installing groff from homebrew/homebrew-dupes
==> Downloading http://ftpmirror.gnu.org/groff/groff-1.22.3.tar.gz
######################################################################## 100.0%
==> Patching
patching file Makefile.in
==> ./configure --prefix=/usr/local/Cellar/groff/1.22.3 --without-x
==> make
==> make install
^@==> Caveats
Attempting to use PDF or HTML output support without using --with-gropdf or
--with-grohtml may result in errors.
==> Summary
🍺  /usr/local/Cellar/groff/1.22.3: 608 files, 14M, built in 83 seconds

利用

[PMAC226S ~/work]$ pandoc -s -f markdown -t man README.md | groff -Dutf8 -Tutf8 -man

sample

# 本記事の方法
[PMAC226S ~/Downloads/takosan-master]$ pandoc -s -f markdown -t man README.md | groff -Dutf8 -Tutf8 -mandoc -mja -E
()                                                                          ()



Takosan
       Takosan    is    a    simple    Web   interface   to   Slack   (Ikachan
       (https://github.com/yappo/p5-App-Ikachan) for Slack).

       [IMAGE: image (./takosan.jpg)]

       Illustrated by [@demiflare168](https://twitter.com/demiflare168)

   Installing
   For Users
       You   can   choose    and    get    binaries    from    the    releases
       (https://github.com/kentaro/takosan/releases) like below:

              $ wget https://github.com/kentaro/takosan/releases/download/v1.0.3/takosan_linux_amd64 -O takosan
              $ chmod +x takosan

   For Developers
       Just go get as below:

              $ go get github.com/kentaro/takosan

   Dependencies
       You have to also go get dependencies as below:

              $ go get github.com/go-martini/martini
              $ go get github.com/martini-contrib/binding
              $ go get github.com/nlopes/slack

lessしたいときはなんかESCって出ちゃうので、とりあえず pandoc -s -f markdown -t man README.md | groff -Dutf8 -Tutf8 -mandoc -mja -E | less -R とする

catするよりはマシかもしれないが・・・  以上!