diff options
| author | saturneric <[email protected]> | 2025-11-07 22:58:38 +0000 |
|---|---|---|
| committer | saturneric <[email protected]> | 2025-11-07 22:58:38 +0000 |
| commit | ccfd38e2ffaf91bc74f3bcd31d503e551591bc8d (patch) | |
| tree | a771157102538946475ddf4864174a00d26e597f | |
| parent | feat(docker): add `py3-markdown` dependency (diff) | |
| download | cgit-ccfd38e2ffaf91bc74f3bcd31d503e551591bc8d.tar.gz cgit-ccfd38e2ffaf91bc74f3bcd31d503e551591bc8d.zip | |
feat(docker): enable `highlight` for syntax filtering
* Add `py3-pygments` and `highlight` to runtime dependencies for improved
syntax highlighting support.
* Switch syntax filtering to use shell script with `highlight` v3 for
better compatibility and output format.
* Update configuration to reference the new filter script, ensuring
consistent code highlighting in generated content.
| -rw-r--r-- | Dockerfile | 2 | ||||
| -rw-r--r-- | cgitrc | 1 | ||||
| -rwxr-xr-x | filters/syntax-highlighting.sh | 4 |
3 files changed, 4 insertions, 3 deletions
@@ -18,7 +18,7 @@ FROM alpine:latest AS runtime COPY --from=builder /var/www/htdocs/cgit /usr/share/webapps/cgit COPY ./filters /usr/lib/cgit/filters -RUN apk --no-cache add lighttpd python3 lua5.4 py3-markdown +RUN apk --no-cache add lighttpd python3 lua5.4 py3-markdown py3-pygments highlight COPY lighttpd.conf /etc/lighttpd/lighttpd.conf COPY cgitrc /etc/cgitrc @@ -76,6 +76,7 @@ side-by-side-diffs=0 # needs python-pygments # source-filter=/usr/lib/cgit/filters/syntax-highlighting.py +source-filter=/usr/lib/cgit/filters/syntax-highlighting.sh # Format markdown, restructuredtext, manpages, text files, and html files through the right converters about-filter=/usr/lib/cgit/filters/about-formatting.sh diff --git a/filters/syntax-highlighting.sh b/filters/syntax-highlighting.sh index 840bc34..5033f58 100755 --- a/filters/syntax-highlighting.sh +++ b/filters/syntax-highlighting.sh @@ -115,7 +115,7 @@ EXTENSION="${BASENAME##*.}" # found (for example) on EPEL 6. # # This is for version 2 -exec highlight --force -f -I -X -S "$EXTENSION" 2>/dev/null +#exec highlight --force -f -I -X -S "$EXTENSION" 2>/dev/null # This is for version 3 -#exec highlight --force -f -I -O xhtml -S "$EXTENSION" 2>/dev/null +exec highlight --force -f -I -O xhtml -S "$EXTENSION" 2>/dev/null |
