Skip to content

Instantly share code, notes, and snippets.

@stupergenius
Forked from hugorodgerbrown/md_to_rst.sh
Last active December 3, 2021 15:55
Show Gist options
  • Save stupergenius/b43d38fbff0547c96322e3f44264a969 to your computer and use it in GitHub Desktop.
Save stupergenius/b43d38fbff0547c96322e3f44264a969 to your computer and use it in GitHub Desktop.
Shell script for converting a batch of rst files into markdown files using pandoc
# This script was created to convert a directory full
# of rst files into markdown 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 .rst file
do
filename="${f%.*}"
echo "Converting $f to $filename.md"
`pandoc -s -o $filename.md $f`
# 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