Skip to content

Instantly share code, notes, and snippets.

@sodejm
Created June 30, 2017 19:02
Show Gist options
  • Save sodejm/bc0eab54c2561733ff9dae096c2b11d7 to your computer and use it in GitHub Desktop.
Save sodejm/bc0eab54c2561733ff9dae096c2b11d7 to your computer and use it in GitHub Desktop.
# Author: sodejm
# Add to bash_profile as a quick way to conver markdown notes to word doc
# requires pandoc to be installed
# use: md2doc file1.md
# this will output file1.doc
# Note: this does not handle docs with spaces in the filename well so feel free to modify that or just name things like file_1.md
function md2doc() {
echo "Converting a markdown file to docx"
filetoconvert=$1
fnamepattern="${filetoconvert##*/}"
fname="${fnamepattern%.*}.docx
pandoc -s -o $fname $1
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment