diff --git a/.bashrc b/.bashrc index 03c3816..f4827ea 100644 --- a/.bashrc +++ b/.bashrc @@ -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 " + 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