added(.bashrc): md2pdf and typstwatch functions
This commit is contained in:
25
.bashrc
25
.bashrc
@@ -126,6 +126,31 @@ m3u8-download() {
|
|||||||
youtube-dl -f $format_code --hls-prefer-native "$1"
|
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 functions
|
||||||
gpg_encrypt () {
|
gpg_encrypt () {
|
||||||
output=~/"${1}".$(date +%s).enc
|
output=~/"${1}".$(date +%s).enc
|
||||||
|
|||||||
Reference in New Issue
Block a user