Skip to content

Instantly share code, notes, and snippets.

@yfwu
Forked from wilmoore/convert.sh
Created May 9, 2014 04:00
Show Gist options
  • Save yfwu/63a310ec7addaa0d95f5 to your computer and use it in GitHub Desktop.
Save yfwu/63a310ec7addaa0d95f5 to your computer and use it in GitHub Desktop.
#!/bin/bash
FILES=`find -iname *.txt -print`
for FILE in $FILES
do
# replace the + to # chars
sed -i -r 's/^([+]{4})\s/#### /' $FILE
sed -i -r 's/^([+]{3})\s/### /' $FILE
sed -i -r 's/^([+]{2})\s/## /' $FILE
sed -i -r 's/^([+]{1})\s/# /' $FILE
sed -i -r 's/(\[php\])/<?php/' $FILE
# convert markdown to reStructured Text
pandoc -f markdown -t rst $FILE > ${FILE%.txt}.rst
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment