Skip to content

Instantly share code, notes, and snippets.

@omaciel
Forked from ldong/rst_to_md.sh
Last active December 8, 2020 17:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save omaciel/2222950d244a94b6152db0a4a259787e to your computer and use it in GitHub Desktop.
Save omaciel/2222950d244a94b6152db0a4a259787e to your computer and use it in GitHub Desktop.
Convert rst to md files
# This script was created to convert a directory full
# of rst files into md 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 .rst files
# 3. Ensure that the script has execute permissions
# 4. Run the script
#
# By default this will keep the original .rst file
for f in $(ls *.rst)
do
# extension="${f##*.}"
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
# see https://gist.github.com/ldong/48f0df6f99396266970d for converting md to rst files
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment