Created
July 17, 2014 08:18
-
-
Save ap--/c0bb422fc265ab608ce0 to your computer and use it in GitHub Desktop.
Convert Docx to Markdown using calibre
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| CDIR=`pwd` | |
| TDIR=`mktemp -d` | |
| DOCXFN=$(basename "$1") | |
| MDFN=${DOCXFN%.docx}.md | |
| echo "Converting: $DOCXFN" | |
| cp "$1" $TDIR | |
| cd $TDIR | |
| ebook-convert $DOCXFN output.htmlz | |
| unzip output.htmlz | |
| pandoc -f html -t markdown+yaml_metadata_block --atx-headers -o $CDIR/$MDFN $TDIR/index.html | |
| rm -R $TDIR |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment