Last active
March 26, 2023 16:57
-
-
Save hugorodgerbrown/5317616 to your computer and use it in GitHub Desktop.
Shell script for converting a batch of *.md files into *.rst using pandoc.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 | |
# extension="${f##*.}" | |
filename="${f%.*}" | |
echo "Converting $f to $filename.rst" | |
`pandoc $f -t rst -o $filename.rst` | |
# uncomment this line to delete the source file. | |
# rm $f | |
done |
Thank you! This is very helpful.
Thanks for this script! Very helpful 👍
How to save and run script ?
muchos gracias
I love github @hugorodgerbrown for president
When I run this I get "open binary file does not exist". help?
@rachrobts Probably spaces in your filenames.
Try adding double-quotes: `pandoc "$f" -t rst -o "docx/$filename.rst"`
Thanks!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Ta for letting me be super lazy. Using this to convert md for sphinx docs.