commit ba36f1eacd3ec67da4c4b1012ecb24e43f184b08 parent 5480041a58c4a800e8ec41fc5a337705ac25b6a4 Author: gearsix <gearsix@tuta.io> Date: Fri, 25 Jun 2021 13:28:41 +0100 updates & fixes in preview-md Diffstat:
M | src/preview-md.sh | | | 12 | ++++++------ |
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/preview-md.sh b/src/preview-md.sh @@ -4,15 +4,15 @@ # dependencies: cmark # e.g.$ preview-md README.md --open -mdconv="cmark --unsafe" -out=/tmp/README.html +mdconv="cmark" +out=$(echo "$1" | sed "s/md/html/") -if [ -e $out ]; then rm $out; fi -$mdconv $1 >> $out +if [ -e "$out" ]; then rm -i $out; fi +$mdconv "$1" > "$out" if [ $? -eq 0 ]; then echo "succesfully converted to $out" - if [ ! -z $2 ] && [ $2 = "--open" ] || [ $2 = "-o" ]; then - xdg-open $out &>/dev/null + if [ ! -z $2 ] && [ "$2" = "--open" ] || [ "$2" = "-o" ]; then + xdg-open "$out" &>/dev/null fi else echo "$mdconv returned $?"