convert_markdown_into_ipynb.sh 425 字节
Newer Older
G
gongweibao 已提交
1 2
#!/bin/sh
command -v go >/dev/null 2>&1
G
gongweibao 已提交
3 4
if [[ $? != 0 ]]; then
    echo >&2 "Please install https://golang.org/doc/install#install"
G
gongweibao 已提交
5 6 7 8 9 10 11 12
    exit 1
fi

#convert to ipynb file
GOPATH=/tmp/go go get -u github.com/wangkuiyi/ipynb/markdown-to-ipynb

for file in $@ ; do
	/tmp/go/bin/markdown-to-ipynb < $file > ${file%.*}".ipynb"
G
gongweibao 已提交
13 14
    if [[ $? != 0 ]]; then
        echo >&2 "markdown-to-ipynb $file error"
G
gongweibao 已提交
15 16 17 18
        exit 1
    fi
done