Skip to content

Instantly share code, notes, and snippets.

@dropletmedia
Created January 6, 2020 17:00
Show Gist options
  • Select an option

  • Save dropletmedia/8533512dd9e406d31583fae41696de01 to your computer and use it in GitHub Desktop.

Select an option

Save dropletmedia/8533512dd9e406d31583fae41696de01 to your computer and use it in GitHub Desktop.
Convert docx to markdown
#!/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"
@dropletmedia
Copy link
Author

Mark this file as executable, and add it's folder to PATH to enjoy the full benefit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment