simple script to convert html <--> markdown, I use to view pretty in lynx
This commit is contained in:
parent
0eee62cfd5
commit
d28e196e5a
30
scripts/panmark
Executable file
30
scripts/panmark
Executable file
@ -0,0 +1,30 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Simple script to convert html <-> markdown
|
||||||
|
|
||||||
|
main() {
|
||||||
|
if [[ ! ( "$1" == *.md || "$1" == *.html ) ]]; then
|
||||||
|
echo "must provide *.md or *.html"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
IFS=$'\n' read -d "" -ra tokens <<< "${1//./$'\n'}"
|
||||||
|
|
||||||
|
input=""
|
||||||
|
output=""
|
||||||
|
|
||||||
|
case ${tokens[1]} in
|
||||||
|
md)
|
||||||
|
input="${tokens[0]}.md"
|
||||||
|
output="${tokens[0]}.html"
|
||||||
|
;;
|
||||||
|
html)
|
||||||
|
input="${tokens[0]}.html"
|
||||||
|
output="${tokens[0]}.md"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
pandoc --from gfm --to html --standalone --output $output < $input
|
||||||
|
}
|
||||||
|
|
||||||
|
main "$@"
|
||||||
Loading…
Reference in New Issue
Block a user