correctly handle unknown syntaxes when highlighting
This commit is contained in:
parent
18b0b14e25
commit
13f2613aaa
6 changed files with 58 additions and 60 deletions
11
syntax_wrapper.sh
Executable file
11
syntax_wrapper.sh
Executable 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
|
Loading…
Add table
Add a link
Reference in a new issue