From af7ffaa2798148e2a1b249da2330200bc032d7b1 Mon Sep 17 00:00:00 2001 From: mrsdizzie Date: Tue, 30 Jun 2020 17:34:03 -0400 Subject: 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 * code review * copy/paste error * Use const for highlight size limit * Update web_src/less/_repository.less Co-authored-by: Lauris BH * 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 Co-authored-by: Lauris BH --- go.mod | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'go.mod') diff --git a/go.mod b/go.mod index dac411590c..9be45c5028 100644 --- a/go.mod +++ b/go.mod @@ -20,6 +20,7 @@ require ( github.com/BurntSushi/toml v0.3.1 github.com/PuerkitoBio/goquery v1.5.0 github.com/RoaringBitmap/roaring v0.4.23 // indirect + github.com/alecthomas/chroma v0.7.3 github.com/bgentry/speakeasy v0.1.0 // indirect github.com/blevesearch/bleve v1.0.7 github.com/couchbase/gomemcached v0.0.0-20191004160342-7b5da2ec40b2 // indirect @@ -66,7 +67,7 @@ require ( github.com/lunny/dingtalk_webhook v0.0.0-20171025031554-e3534c89ef96 github.com/mailru/easyjson v0.7.0 // indirect github.com/markbates/goth v1.61.2 - github.com/mattn/go-isatty v0.0.11 + github.com/mattn/go-isatty v0.0.12 github.com/mattn/go-sqlite3 v2.0.2+incompatible github.com/mcuadros/go-version v0.0.0-20190308113854-92cdf37c5b75 github.com/mgechev/dots v0.0.0-20190921121421-c36f7dcfbb81 @@ -99,6 +100,7 @@ require ( github.com/urfave/cli v1.20.0 github.com/xanzy/go-gitlab v0.31.0 github.com/yohcop/openid-go v1.0.0 + github.com/yuin/goldmark-highlighting v0.0.0-20200307114337-60d527fdb691 github.com/yuin/goldmark v1.1.32 github.com/yuin/goldmark-meta v0.0.0-20191126180153-f0638e958b60 golang.org/x/crypto v0.0.0-20200604202706-70a84ac30bf9 -- cgit v1.2.3