LoginSignup
12
13

More than 5 years have passed since last update.

markdown をコマンドラインでプレビュー

Last updated at Posted at 2012-03-16

w3m と markdown が必要。
-dump とるとインタラクティブ。

function markdown_preview(){
    if [ $# -ne 1 ]
    then
        echo "error: invalid arguments"
        echo "usage: $0 markdown_file"
        return 1
    fi

    if [ ! -f "$1" ]
    then
        echo "error: $1 dose not exists"
        return 2
    fi

    (echo '<html><head><meta charset="UTF-8" /></head><body>';
        markdown $1; echo '</body></html>')\
        | w3m -T text/html -dump

    # screen で縦割りしたときにズレる問題解決
    if [ $STY ]
    then
        sleep 0.2
        screen -X redisplay
    fi
}

12
13
0

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
12
13