correctly handle unknown syntaxes when highlighting

This commit is contained in:
Alexander 2025-06-16 18:57:50 -04:00
parent 18b0b14e25
commit 13f2613aaa
6 changed files with 58 additions and 60 deletions

11
syntax_wrapper.sh Executable file
View file

@ -0,0 +1,11 @@
#! /usr/bin/env bash
if [[ "$#" -lt 2 ]]; then
printf "<code>$(cat)</code>"
fi
if grep -qw ${name:-} <<< $(pygmentize -L lexers); then
pygmentize -l $1 -f html | head -c -13 | awk -F '<pre>' '{print $NF}'
else
printf "<code>$(cat)</code>"
fi