correctly handle unknown syntaxes when highlighting
This commit is contained in:
parent
18b0b14e25
commit
64acf09214
6 changed files with 56 additions and 60 deletions
9
syntax_wrapper.sh
Executable file
9
syntax_wrapper.sh
Executable file
|
@ -0,0 +1,9 @@
|
|||
#! /usr/bin/env bash
|
||||
|
||||
if [[ $# -lt 1 ]] || ! { pygmentize -L lexers | grep -qw "$1"; }; then
|
||||
printf "<code>"
|
||||
cat
|
||||
printf "</code>"
|
||||
else
|
||||
pygmentize -l $1 -f html | head -c -13 | awk -F '<pre>' '{print $NF}'
|
||||
fi
|
Loading…
Add table
Add a link
Reference in a new issue