Add markdown preview

This commit is contained in:
Digital Studium 2024-03-17 11:56:36 +03:00
parent 75cebed2e4
commit d3d16b3ab6
3 changed files with 52 additions and 1 deletions

43
install_fonts.sh Normal file
View File

@ -0,0 +1,43 @@
#!/bin/bash
declare -a fonts=(
BitstreamVeraSansMono
CodeNewRoman
DroidSansMono
FiraCode
FiraMono
Go-Mono
Hack
Hermit
JetBrainsMono
Meslo
Noto
Overpass
ProggyClean
RobotoMono
SourceCodePro
SpaceMono
Ubuntu
UbuntuMono
)
version='3.1.1'
fonts_dir="${HOME}/.local/share/fonts"
if [[ ! -d "$fonts_dir" ]]; then
mkdir -p "$fonts_dir"
fi
for font in "${fonts[@]}"; do
zip_file="${font}.zip"
download_url="https://github.com/ryanoasis/nerd-fonts/releases/download/v${version}/${zip_file}"
echo "Downloading $download_url"
wget "$download_url"
unzip "$zip_file" -d "$fonts_dir"
rm "$zip_file"
done
find "$fonts_dir" -name '*Windows Compatible*' -delete
fc-cache -fv

View File

@ -31,7 +31,9 @@ tensorrt-libs \
bat \
locales \
fzf \
scrot
scrot `# screenshots` \
libreadline-dev `# for nnn` \
nnn `# nnn is file manager`
sudo locale-gen ru_RU
sudo locale-gen ru_RU.UTF-8

View File

@ -33,6 +33,12 @@ case "$MIME" in
unzip -l "$1"
;;
# any plain text file that doesn't have a specific handler
*text/plain*)
pandoc $1 > /tmp/lf_preview.html && cutycapt --url=file:///tmp/lf_preview.html --out=/tmp/lf_preview.png && chafa -s "$2x$3" -f sixel /tmp/lf_preview.png
;;
*text/plain*)
;;
# any plain text file that doesn't have a specific handler
*text/plain*)
# return false to always repaint, in case terminal size changes
batcat --force-colorization --paging=never --style=changes,numbers \