Last active
August 29, 2015 14:17
-
-
Save shamille/2003c60930f29f83357f to your computer and use it in GitHub Desktop.
Script to create web page from markdown file using pandoc and then update website via git
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
#!/bin/bash | |
# md-to-html.sh | |
# Script to create web page from markdown file using Pandoc | |
read -e -p "Enter filename: " mdFile | |
tmpFile=`cat $mdFile` | |
echo "$tmpFile" > forPandoc.txt | |
title="${mdFile%.*}" | |
echo "<html> | |
<head> | |
<title>"$title"</title> | |
</head> | |
<body>" > htmlFile.html | |
pandoc -f markdown -t html forPandoc.txt >> htmlFile.html | |
echo "</body></html>" >> htmlFile.html | |
extension=".html" | |
newFile="${title}${extension}" | |
mv -i htmlFile.html $newFile | |
git commit -m "change from script" $newFile | git push | |
rm forPandoc.txt | |
echo "All done. Your file is called $newFile." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment