Add a command for viewing Markdown. md()
David Blume

David Blume commited on 2019-05-02 18:22:33
Showing 1 changed files, with 12 additions and 0 deletions.

... ...
@@ -67,6 +67,18 @@ alias clip="expand | cut -b1-\$COLUMNS"
67 67
 # For httpie: https://github.com/jakubroztocil/httpie#installation
68 68
 alias https='http --default-scheme=https'
69 69
 
70
+md() {
71
+    if [[ $(uname -s) == Darwin* ]]; then
72
+        T=$(mktemp $TMPDIR$(uuidgen).html)
73
+	curl -X POST --data-binary @"$1" https://md.dlma.com/ > $T
74
+	open -a /Applications/Safari.app $T
75
+    else
76
+        T=$(mktemp --suffix=.html)
77
+	curl -X POST --data-binary @"$1" https://md.dlma.com/ > $T
78
+	xdg-open $T
79
+    fi
80
+}
81
+
70 82
 if [ -f $HOME/.localrc ]; then
71 83
     source $HOME/.localrc
72 84
 fi
73 85