Skip to content

Instantly share code, notes, and snippets.

@anthonydillon
Created November 7, 2018 23:02
Show Gist options
  • Save anthonydillon/d23a2b969dd788e27fb83470c27f3e88 to your computer and use it in GitHub Desktop.
Save anthonydillon/d23a2b969dd788e27fb83470c27f3e88 to your computer and use it in GitHub Desktop.
# This script was created to convert a directory full
# of markdown files into rst equivalents. It uses
# pandoc to do the conversion.
#
# 1. Install pandoc from http://johnmacfarlane.net/pandoc/
# 2. Copy this script into the directory containing the .md files
# 3. Ensure that the script has execute permissions
# 4. Run the script
#
# By default this will keep the original .md file
FILES=*.md
for f in $FILES
do
filename="${f%.*}"
echo "Converting $f to $filename.html"
`pandoc $f -f markdown -t html -o $filename.html`
# uncomment this line to delete the source file.
# rm $f
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment