web: keep an added line's leading dash in the diff !131

merged merged by cmc on 2026-08-31 05:21 UTC · krz/gitbay:diff-marker-strip into main

Discussion

cmc

sideText built the syntax-highlighting source from the raw diff line:

strings.TrimPrefix(strings.TrimPrefix(l.Text, "+"), "-")

On an added line whose content begins with a dash — a Markdown bullet, a docstring list — the first call strips the + marker and the second then strips the content's own dash, so the rendered line loses it. Context lines begin with a space, so neither prefix matches and theirs survive; the two render inconsistently side by side.

diffLine.Content is already the line without its marker, computed per class where the line is classified. sideText uses it.

Test covers an added line that is a Markdown bullet, which fails on the old code with added line "- two" highlighted as " two". Full suite green, including e2e.