added(.bashrc): md2pdf and typstwatch functions

This commit is contained in:
2026-05-18 07:37:02 +02:00
parent 65f37424fd
commit 11f14677c0

25
.bashrc
View File

@@ -126,6 +126,31 @@ m3u8-download() {
youtube-dl -f $format_code --hls-prefer-native "$1"
}
md2pdf() {
if [[ -z "$1" ]]; then
echo "Usage: md2pdf input.md [output.pdf]"
return 1
fi
local input="$1"
local output="${2:-${input%.*}.pdf}"
# Adding -V mainfont resolves the empty font fallback error
pandoc "$input" -o "$output" --pdf-engine=typst -V mainfont="DejaVu Sans"
}
typstwatch() {
if [[ -z "$1" ]]; then
echo "Usage: tw <filename>"
return 1
fi
# Strip extension if provided and use the base name
local base="${1%.*}"
(zathura "${base}.pdf" &) && typst watch "${base}.typ"
}
## GPG functions
gpg_encrypt () {
output=~/"${1}".$(date +%s).enc