1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-22 18:28:37 +00:00

Server-side syntax highlighting for all code (#12047)

* Server-side syntax hilighting for all code

This PR does a few things:

* Remove all traces of highlight.js
* Use chroma library to provide fast syntax hilighting directly on the server
* Provide syntax hilighting for diffs
* Re-style both unified and split diffs views
* Add custom syntax hilighting styling for both regular and arc-green

Fixes #7729
Fixes #10157
Fixes #11825
Fixes #7728
Fixes #3872
Fixes #3682

And perhaps gets closer to #9553

* fix line marker

* fix repo search

* Fix single line select

* properly load settings

* npm uninstall highlight.js

* review suggestion

* code review

* forgot to call function

* fix test

* Apply suggestions from code review

suggestions from @silverwind thanks

Co-authored-by: silverwind <me@silverwind.io>

* code review

* copy/paste error

* Use const for highlight size limit

* Update web_src/less/_repository.less

Co-authored-by: Lauris BH <lauris@nix.lv>

* update size limit to 1MB and other styling tweaks

* fix highlighting for certain diff sections

* fix test

* add worker back as suggested

Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: Lauris BH <lauris@nix.lv>
This commit is contained in:
mrsdizzie
2020-06-30 17:34:03 -04:00
committed by GitHub
parent ce5f2b9845
commit af7ffaa279
336 changed files with 37293 additions and 769 deletions

46
vendor/modules.txt vendored
View File

@@ -62,6 +62,38 @@ github.com/PuerkitoBio/urlesc
# github.com/RoaringBitmap/roaring v0.4.23
## explicit
github.com/RoaringBitmap/roaring
# github.com/alecthomas/chroma v0.7.3
## explicit
github.com/alecthomas/chroma
github.com/alecthomas/chroma/formatters/html
github.com/alecthomas/chroma/lexers
github.com/alecthomas/chroma/lexers/a
github.com/alecthomas/chroma/lexers/b
github.com/alecthomas/chroma/lexers/c
github.com/alecthomas/chroma/lexers/circular
github.com/alecthomas/chroma/lexers/d
github.com/alecthomas/chroma/lexers/e
github.com/alecthomas/chroma/lexers/f
github.com/alecthomas/chroma/lexers/g
github.com/alecthomas/chroma/lexers/h
github.com/alecthomas/chroma/lexers/i
github.com/alecthomas/chroma/lexers/internal
github.com/alecthomas/chroma/lexers/j
github.com/alecthomas/chroma/lexers/k
github.com/alecthomas/chroma/lexers/l
github.com/alecthomas/chroma/lexers/m
github.com/alecthomas/chroma/lexers/n
github.com/alecthomas/chroma/lexers/o
github.com/alecthomas/chroma/lexers/p
github.com/alecthomas/chroma/lexers/q
github.com/alecthomas/chroma/lexers/r
github.com/alecthomas/chroma/lexers/s
github.com/alecthomas/chroma/lexers/t
github.com/alecthomas/chroma/lexers/v
github.com/alecthomas/chroma/lexers/w
github.com/alecthomas/chroma/lexers/x
github.com/alecthomas/chroma/lexers/y
github.com/alecthomas/chroma/styles
# github.com/andybalholm/brotli v0.0.0-20190621154722-5f990b63d2d6
github.com/andybalholm/brotli
# github.com/andybalholm/cascadia v1.0.0
@@ -158,6 +190,8 @@ github.com/couchbaselabs/go-couchbase
## explicit
# github.com/cznic/strutil v0.0.0-20181122101858-275e90344537
## explicit
# github.com/danwakefield/fnmatch v0.0.0-20160403171240-cbb64ac3d964
github.com/danwakefield/fnmatch
# github.com/davecgh/go-spew v1.1.1
github.com/davecgh/go-spew/spew
# github.com/denisenkom/go-mssqldb v0.0.0-20200428022330-06a60b6afbbc
@@ -169,6 +203,9 @@ github.com/denisenkom/go-mssqldb/internal/querytext
# github.com/dgrijalva/jwt-go v3.2.0+incompatible
## explicit
github.com/dgrijalva/jwt-go
# github.com/dlclark/regexp2 v1.2.0
github.com/dlclark/regexp2
github.com/dlclark/regexp2/syntax
# github.com/dsnet/compress v0.0.1
github.com/dsnet/compress
github.com/dsnet/compress/bzip2
@@ -378,7 +415,7 @@ github.com/gorilla/context
github.com/gorilla/css/scanner
# github.com/gorilla/handlers v1.4.2
github.com/gorilla/handlers
# github.com/gorilla/mux v1.6.2
# github.com/gorilla/mux v1.7.3
github.com/gorilla/mux
# github.com/gorilla/securecookie v1.1.1
github.com/gorilla/securecookie
@@ -498,9 +535,9 @@ github.com/markbates/goth/providers/nextcloud
github.com/markbates/goth/providers/openidConnect
github.com/markbates/goth/providers/twitter
github.com/markbates/goth/providers/yandex
# github.com/mattn/go-colorable v0.1.4
# github.com/mattn/go-colorable v0.1.6
github.com/mattn/go-colorable
# github.com/mattn/go-isatty v0.0.11
# github.com/mattn/go-isatty v0.0.12
## explicit
github.com/mattn/go-isatty
# github.com/mattn/go-runewidth v0.0.7
@@ -688,6 +725,9 @@ github.com/yuin/goldmark/renderer
github.com/yuin/goldmark/renderer/html
github.com/yuin/goldmark/text
github.com/yuin/goldmark/util
# github.com/yuin/goldmark-highlighting v0.0.0-20200307114337-60d527fdb691
## explicit
github.com/yuin/goldmark-highlighting
# github.com/yuin/goldmark-meta v0.0.0-20191126180153-f0638e958b60
## explicit
github.com/yuin/goldmark-meta