dots


commit
52e9eeb
parent
5ad84fb
author
xxwhirlpool
date
2025-10-22 19:05:44 -0400 EDT
fixes for md2html
1 files changed,  +6, -2
M config/.local/bin/md2html
+6, -2
 1@@ -4,14 +4,14 @@
 2 # can read from STDIN or file
 3 #
 4 # this is a *very* opinionated script, using:
 5-# gum, bat, perl, and xclip
 6+# gum, bat, perl, openssl, and xclip
 7 # pandoc is mandatory!!!
 8 # edit to suit your system
 9 
10 # functions
11 read() {
12 	# declare some vars
13-	MDFILE="/tmp/$(today time && openssl rand -hex 5).md"
14+	MDFILE="/tmp/$(openssl rand -hex 5).md"
15 	HTMLFILE="${MDFILE%.*}.html"
16 	HTMLFILE_FINAL="${HTMLFILE%.*}_final.html"
17 	# prompt user to paste markdown formatted text, then write it to a temp file
18@@ -24,6 +24,8 @@ read() {
19 	batcat --paging=never "$HTMLFILE_FINAL"
20 	# copy file to clipboard too
21 	xclip -sel clip "$HTMLFILE_FINAL"
22+	# cleanup
23+	rm "$HTMLFILE"
24 }
25 
26 fromfile() {
27@@ -39,6 +41,8 @@ fromfile() {
28 	batcat --paging=never "$HTMLFILE_FINAL"
29 	# copy file to clipboard too
30 	xclip -sel clip "$HTMLFILE_FINAL"
31+	# cleanup
32+	rm "$HTMLFILE"
33 }
34 
35 # execute it