Guest User

Untitled

a guest
Nov 17th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. .
  2. ├── html
  3. └── md
  4.  
  5. #! /bin/bash
  6. # run this from a folder containing markdown files
  7. # it delivers html to the sibling html folder
  8. if hash pandoc 2>/dev/null; then
  9. for file in ./*.md ; do
  10. echo Converting $file
  11. cat "$file" | pandoc -o "$(echo $file | sed 's/^./../html/' | sed 's/.md$/.html/')"
  12. done
  13. else
  14. echo "I need pandoc installed"
  15. fi
  16.  
  17. if [ $# -gt 0 ]; then
  18. pandoc $file --template=$1 -o "../html/${file%md}html"
  19. else
  20. pandoc $file -o "../html/${file%md}html"
  21. fi
  22.  
  23. for file in *.md; do
  24. pandoc -o ../html/${file%md}html
  25. done
  26.  
  27. ../html/%.html: %.md
  28. pandoc -o $@ $<
Add Comment
Please, Sign In to add comment