convert_markdown_into_ipynb.sh 423 字节
Newer Older
G
gongweibao 已提交
1 2
#!/bin/sh
command -v go >/dev/null 2>&1
G
gongweibao 已提交
3
if [ $? -ne 0 ]; then
G
gongweibao 已提交
4
    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
    if [ $? -ne 0 ]; then
G
gongweibao 已提交
14
        echo >&2 "markdown-to-ipynb $file error"
G
gongweibao 已提交
15 16 17 18
        exit 1
    fi
done