From a3011c5e169339264c1f84a348732f24c9df7abb Mon Sep 17 00:00:00 2001 From: Alexander Kassouni Date: Wed, 7 Oct 2026 01:48:07 -0700 Subject: syntax, markdown css for cgit --- git/cgit.scss | 158 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 158 insertions(+) (limited to 'git') diff --git a/git/cgit.scss b/git/cgit.scss index 12708ee..524966f 100644 --- a/git/cgit.scss +++ b/git/cgit.scss @@ -1,3 +1,4 @@ +@use "sass:list"; @use "palette"; @use "fonts"; @@ -865,3 +866,160 @@ div#cgit table.ssdiff td.space div { min-height: 3em; } +div#cgit .highlight span { + background: transparent; + font-weight: normal; + font-style: normal; +} + +$-syntax: ( + "grey": (c, ch, cm, c1, cs, w), + "orange": (k, kc, kd, kn, kr, kp, ow, cp), + "green": (s, s1, s2, sa, sb, sc, sd, sh, ss, sx, dl, cpf, gi), + "purple": (m, mb, mf, mh, mi, mo, il, no), + "yellow": (nf, fm, nd), + "blue": (kt, nc, ne, nn, nt), + "cyan": (nb, bp, na, nl, py, se, si, sr, gu), + "fg": (nv, vc, vg, vi, vm), + "fg-dim": (o, p, go, gp), + "red": (err, gr, gt, gd), +); + +@each $colour, $classes in $-syntax { + $sel: (); + @each $class in $classes { + $sel: list.append($sel, #{"div#cgit .highlight ." + $class}, comma); + } + + #{$sel} { + color: var(--#{$colour}); + } +} + +div#cgit .highlight .c, +div#cgit .highlight .ch, +div#cgit .highlight .cm, +div#cgit .highlight .c1, +div#cgit .highlight .cs, +div#cgit .highlight .ge { + font-style: italic; +} + +div#cgit .highlight .k, +div#cgit .highlight .kc, +div#cgit .highlight .kd, +div#cgit .highlight .kn, +div#cgit .highlight .kr, +div#cgit .highlight .gs, +div#cgit .highlight .gh { + font-weight: bold; +} + +div#cgit .highlight .ges { + font-weight: bold; + font-style: italic; +} + +div#cgit .highlight .gh { + color: var(--fg-bright); +} + +div#cgit .highlight .hll { + background: var(--bg-sel); +} + +div#cgit .highlight { + background: transparent; +} + +div#cgit .markdown-body h1, +div#cgit .markdown-body h2, +div#cgit .markdown-body h3, +div#cgit .markdown-body h4, +div#cgit .markdown-body h5 { + color: var(--fg-bright); +} + +div#cgit .markdown-body h6 { + color: var(--fg-dim); +} + +div#cgit .markdown-body h2 { + border-bottom: 1px solid var(--grey); +} + +$-headings: h1, h2, h3, h4, h5, h6; +$-toclinks: (); + +@each $h in $-headings { + $-toclinks: list.append( + $-toclinks, + #{"div#cgit div.markdown-body " + $h + " a.toclink"}, + comma + ); +} + +#{$-toclinks} { + color: inherit; +} + +div#cgit .markdown-body a.absent { + color: var(--red); +} + +div#cgit .markdown-body blockquote { + border-left: 4px solid var(--grey); + color: var(--fg-dim); +} + +div#cgit .markdown-body hr { + border: 2px solid var(--grey); +} + +div#cgit .markdown-body table th, +div#cgit .markdown-body table td { + border: 1px solid var(--grey); +} + +div#cgit .markdown-body table tr { + border-top: 1px solid var(--grey); + background-color: var(--bg); +} + +div#cgit .markdown-body table tr:nth-child(2n) { + background-color: var(--bg-alt); +} + +div#cgit .markdown-body code, +div#cgit .markdown-body tt { + border: 1px solid var(--grey); + background-color: var(--bg-alt); +} + +div#cgit .markdown-body .highlight pre, +div#cgit .markdown-body pre { + background-color: var(--bg-alt); + border: 1px solid var(--grey); +} + +div#cgit .markdown-body pre code, +div#cgit .markdown-body pre tt, +div#cgit .markdown-body pre > code { + background-color: transparent; + border: none; +} + +div#cgit .markdown-body span.frame > span { + border: 1px solid var(--grey); +} + +div#cgit .markdown-body span.frame span span { + color: var(--fg); +} + +div#cgit td.linenos .special, +div#cgit span.linenos.special { + color: var(--fg); + background-color: var(--bg-sel); +} + -- cgit v1.3.1