Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .
- ├── html
- └── md
- #! /bin/bash
- # run this from a folder containing markdown files
- # it delivers html to the sibling html folder
- if hash pandoc 2>/dev/null; then
- for file in ./*.md ; do
- echo Converting $file
- cat "$file" | pandoc -o "$(echo $file | sed 's/^./../html/' | sed 's/.md$/.html/')"
- done
- else
- echo "I need pandoc installed"
- fi
- if [ $# -gt 0 ]; then
- pandoc $file --template=$1 -o "../html/${file%md}html"
- else
- pandoc $file -o "../html/${file%md}html"
- fi
- for file in *.md; do
- pandoc -o ../html/${file%md}html
- done
- ../html/%.html: %.md
- pandoc -o $@ $<
Add Comment
Please, Sign In to add comment