Created
January 6, 2020 17:00
-
-
Save dropletmedia/8533512dd9e406d31583fae41696de01 to your computer and use it in GitHub Desktop.
Convert docx to markdown
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 | |
| # a script to convert docx to markdown and extract images into subfolder | |
| # requirements: pandoc | |
| # | |
| if [ -z "$1" ]; then | |
| echo "Usage:" | |
| echo "" | |
| echo " docx-to-md.sh [filename-no-extension]" | |
| exit 13 | |
| fi | |
| if [ ! -f "$1.docx" ]; then | |
| echo "FATAL missing file '$1.docx'" | |
| exit 11 | |
| fi | |
| mkdir -p "$1" | |
| cd "$1" | |
| pandoc -f docx -t markdown --extract-media="." -o "$1.md" "../$1.docx" |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Mark this file as executable, and add it's folder to PATH to enjoy the full benefit