Sign in

Search issue titles and bodies, change requests and comments. Private repositories you cannot read are not included.

vole
Clone

Read only, no credentials:

https://rodent.software/git/vole.git

Write over SSH with a registered key:

git clone ssh://git@0.0.0.0:2222/vole.git

A free and open-source forge that lives in your Git repo.

Stop comment-card styles from painting syntax tokens

cfd43dcd840ed39144d96fbd7a0d4ecd7fe50879 · Keenan Nemetz · 12d ago · parent dd440279

Stop comment-card styles from painting syntax tokens

Prism calls a token "comment", so the discussion card's unscoped .comment rule put its background and border behind every comment-coloured line in a blob or diff. Scope the card, its target/deleted/editing states, and nested replies to article.comment.

server/ui_test.go +18

@@ -86,6 +86,24 @@ func TestStaticAssetsAreServedFromTheBinary(t *testing.T) {
86 86 }
87 87 }
88 88
89 // Prism uses "comment" for a syntax token, so an unscoped .comment rule paints
90 // the discussion card's background and border behind every comment-coloured line
91 // in a blob or diff. The card is always an <article>, and its base rule names it.
92 func TestCommentCardStyleDoesNotMatchPrismTokens(t *testing.T) {
93 t.Parallel()
94 f := newFixture(t)
95 code, css := f.get("/static/vole.css")
96 if code != 200 {
97 t.Fatalf("stylesheet = %d", code)
98 }
99 if !strings.Contains(css, "article.comment {") {
100 t.Fatal("the comment card's base rule is not scoped to article.comment")
101 }
102 if strings.Contains(css, "\n.comment {") {
103 t.Fatal("an unscoped .comment rule also matches Prism's comment token")
104 }
105 }
106
89 107 // HTMX adds its indicator styles with a <style> element unless told not to.
90 108 // style-src 'self' blocks that injection, so the shell must carry the config
91 109 // that turns it off and the stylesheet must carry the rules it would have added.