From ec0a06e52c67dd3aef25afd940d146c4bbae2020 Mon Sep 17 00:00:00 2001 From: silverwind Date: Mon, 26 Sep 2022 07:50:03 +0200 Subject: Upgrade chroma to v2.3.0 (#21259) The behaviour of `PreventSurroundingPre` has changed in https://github.com/alecthomas/chroma/pull/618 so that apparently it now causes line wrapper tags to be no longer emitted, but we need some form of indication to split the HTML into lines, so I did what https://github.com/yuin/goldmark-highlighting/pull/33 did and added the `nopWrapper`. Maybe there are more elegant solutions but for some reason, just splitting the HTML string on `\n` did not work. Co-authored-by: wxiaoguang --- services/gitdiff/highlightdiff_test.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'services/gitdiff') diff --git a/services/gitdiff/highlightdiff_test.go b/services/gitdiff/highlightdiff_test.go index 1cd78bc942..205f9a0773 100644 --- a/services/gitdiff/highlightdiff_test.go +++ b/services/gitdiff/highlightdiff_test.go @@ -21,11 +21,11 @@ func TestDiffWithHighlight(t *testing.T) { " run(db)\n", ) - expected := ` run('<>')` + "\n" + expected := ` run('<>')` output := diffToHTML(nil, diffs, DiffLineDel) assert.Equal(t, expected, output) - expected = ` run(db)` + "\n" + expected = ` run(db)` output = diffToHTML(nil, diffs, DiffLineAdd) assert.Equal(t, expected, output) @@ -57,7 +57,7 @@ func TestDiffWithHighlightPlaceholder(t *testing.T) { assert.Equal(t, "", hcd.placeholderTokenMap[0x00100000]) assert.Equal(t, "", hcd.placeholderTokenMap[0x0010FFFD]) - expected := fmt.Sprintf(`a='%s'`, "\U00100000") + expected := fmt.Sprintf(`a='%s'`, "\U00100000") output := diffToHTML(hcd.lineWrapperTags, diffs, DiffLineDel) assert.Equal(t, expected, output) -- cgit v1.2.3