aboutsummaryrefslogtreecommitdiffstats
path: root/web_src/less/_chroma.less
diff options
context:
space:
mode:
authormrsdizzie <info@mrsdizzie.com>2020-06-30 17:34:03 -0400
committerGitHub <noreply@github.com>2020-07-01 00:34:03 +0300
commitaf7ffaa2798148e2a1b249da2330200bc032d7b1 (patch)
tree4f1f41767fa620dff4142ac7ebcd74b0abd61033 /web_src/less/_chroma.less
parentce5f2b9845659efaca0b81998dca6cf03882b134 (diff)
downloadgitea-af7ffaa2798148e2a1b249da2330200bc032d7b1.tar.gz
gitea-af7ffaa2798148e2a1b249da2330200bc032d7b1.zip
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>
Diffstat (limited to 'web_src/less/_chroma.less')
-rw-r--r--web_src/less/_chroma.less380
1 files changed, 380 insertions, 0 deletions
diff --git a/web_src/less/_chroma.less b/web_src/less/_chroma.less
new file mode 100644
index 0000000000..2940f17f3b
--- /dev/null
+++ b/web_src/less/_chroma.less
@@ -0,0 +1,380 @@
+/* Background */
+
+.chroma {
+ background-color: #ffffff;
+}
+/* LineTableTD */
+
+.chroma .lntd {
+ vertical-align: top;
+ padding: 0;
+ margin: 0;
+ border: 0;
+}
+/* LineTable */
+
+.chroma .lntable {
+ border-spacing: 0;
+ padding: 0;
+ margin: 0;
+ border: 0;
+ width: auto;
+ overflow: auto;
+ display: block;
+}
+/* LineHighlight */
+
+.chroma .hl {
+ display: block;
+ width: 100%;
+ background-color: #e5e5e5;
+}
+/* LineNumbersTable */
+
+.chroma .lnt {
+ margin-right: .4em;
+ padding: 0 .4em;
+ color: #7f7f7f;
+}
+/* LineNumbers */
+
+.chroma .ln {
+ margin-right: .4em;
+ padding: 0 .4em;
+ color: #7f7f7f;
+}
+/* Keyword */
+
+.chroma .k {
+ color: #d73a49;
+}
+/* KeywordConstant */
+
+.chroma .kc {
+ color: #d73a49;
+}
+/* KeywordDeclaration */
+
+.chroma .kd {
+ color: #d73a49;
+}
+/* KeywordNamespace */
+
+.chroma .kn {
+ color: #d73a49;
+}
+/* KeywordPseudo */
+
+.chroma .kp {
+ color: #d73a49;
+}
+/* KeywordReserved */
+
+.chroma .kr {
+ color: #d73a49;
+}
+/* KeywordType */
+
+.chroma .kt {
+ color: #445588;
+}
+/* NameAttribute */
+
+.chroma .na {
+ color: #d73a49;
+}
+/* NameBuiltin */
+
+.chroma .nb {
+ color: #005cc5;
+}
+/* NameBuiltinPseudo */
+
+.chroma .bp {
+ color: #999999;
+}
+/* NameClass */
+
+.chroma .nc {
+ color: #445588;
+}
+/* NameConstant */
+
+.chroma .no {
+ color: #008080;
+}
+/* NameDecorator */
+
+.chroma .nd {
+ color: #3c5d5d;
+}
+/* NameEntity */
+
+.chroma .ni {
+ color: #6f42c1;
+}
+/* NameException */
+
+.chroma .ne {
+ color: #990000;
+}
+/* NameFunction */
+
+.chroma .nf {
+ color: #005cc5;
+}
+/* NameLabel */
+
+.chroma .nl {
+ color: #990000;
+}
+/* NameNamespace */
+
+.chroma .nn {
+ color: #555555;
+}
+/* NameOther */
+
+.chroma .nx {
+ color: #24292e;
+}
+/* NameTag */
+
+.chroma .nt {
+ color: #22863a;
+}
+/* NameVariable */
+
+.chroma .nv {
+ color: #008080;
+}
+/* NameVariableClass */
+
+.chroma .vc {
+ color: #008080;
+}
+/* NameVariableGlobal */
+
+.chroma .vg {
+ color: #008080;
+}
+/* NameVariableInstance */
+
+.chroma .vi {
+ color: #008080;
+}
+/* LiteralString */
+
+.chroma .s {
+ color: #032f62;
+}
+/* LiteralStringAffix */
+
+.chroma .sa {
+ color: #032f62;
+}
+/* LiteralStringBacktick */
+
+.chroma .sb {
+ color: #032f62;
+}
+/* LiteralStringChar */
+
+.chroma .sc {
+ color: #032f62;
+}
+/* LiteralStringDelimiter */
+
+.chroma .dl {
+ color: #032f62;
+}
+/* LiteralStringDoc */
+
+.chroma .sd {
+ color: #032f62;
+}
+/* LiteralStringDouble */
+
+.chroma .s2 {
+ color: #032f62;
+}
+/* LiteralStringEscape */
+
+.chroma .se {
+ color: #032f62;
+}
+/* LiteralStringHeredoc */
+
+.chroma .sh {
+ color: #032f62;
+}
+/* LiteralStringInterpol */
+
+.chroma .si {
+ color: #032f62;
+}
+/* LiteralStringOther */
+
+.chroma .sx {
+ color: #032f62;
+}
+/* LiteralStringRegex */
+
+.chroma .sr {
+ font-weight: bold;
+ color: #22863a;
+}
+/* LiteralStringSingle */
+
+.chroma .s1 {
+ color: #24292e;
+}
+/* LiteralStringSymbol */
+
+.chroma .ss {
+ color: #032f62;
+}
+/* LiteralNumber */
+
+.chroma .m {
+ color: #009999;
+}
+/* LiteralNumberBin */
+
+.chroma .mb {
+ color: #009999;
+}
+/* LiteralNumberFloat */
+
+.chroma .mf {
+ color: #009999;
+}
+/* LiteralNumberHex */
+
+.chroma .mh {
+ color: #009999;
+}
+/* LiteralNumberInteger */
+
+.chroma .mi {
+ color: #009999;
+}
+/* LiteralNumberIntegerLong */
+
+.chroma .il {
+ color: #009999;
+}
+/* LiteralNumberOct */
+
+.chroma .mo {
+ color: #009999;
+}
+/* Operator */
+
+.chroma .o {
+ color: #d73a49;
+}
+/* OperatorWord */
+
+.chroma .ow {
+ color: #d73a49;
+}
+/* Comment */
+
+.chroma .c {
+ color: #6a737d;
+}
+/* CommentHashbang */
+
+.chroma .ch {
+ color: #6a737d;
+}
+/* CommentMultiline */
+
+.chroma .cm {
+ color: #999988;
+}
+/* CommentSingle */
+
+.chroma .c1 {
+ color: #6a737d;
+}
+/* CommentSpecial */
+
+.chroma .cs {
+ color: #999999;
+ font-style: italic;
+}
+/* CommentPreproc */
+
+.chroma .cp {
+ color: #999999;
+}
+/* CommentPreprocFile */
+
+.chroma .cpf {
+ color: #999999;
+}
+/* GenericDeleted */
+
+.chroma .gd {
+ color: #000000;
+ background-color: #ffdddd;
+}
+/* GenericEmph */
+
+.chroma .ge {
+ color: #000000;
+ font-style: italic;
+}
+/* GenericError */
+
+.chroma .gr {
+ color: #aa0000;
+}
+/* GenericHeading */
+
+.chroma .gh {
+ color: #999999;
+}
+/* GenericInserted */
+
+.chroma .gi {
+ color: #000000;
+ background-color: #ddffdd;
+}
+/* GenericOutput */
+
+.chroma .go {
+ color: #888888;
+}
+/* GenericPrompt */
+
+.chroma .gp {
+ color: #555555;
+}
+/* GenericStrong */
+
+.chroma .gs {
+ font-weight: bold;
+}
+/* GenericSubheading */
+
+.chroma .gu {
+ color: #aaaaaa;
+}
+/* GenericTraceback */
+
+.chroma .gt {
+ color: #aa0000;
+}
+/* GenericUnderline */
+
+.chroma .gl {
+ text-decoration: underline;
+}
+/* TextWhitespace */
+
+.chroma .w {
+ color: #bbbbbb;
+}