Highlighted diff emitting extraneous newlines #5700

Closed
opened 2025-11-02 06:33:30 -06:00 by GiteaMirror · 1 comment
Owner

Originally created by @silverwind on GitHub (Jul 7, 2020).

Example: 03967f99a6

https://github.com/go-gitea/gitea/pull/12047 seems to cause text in diffs to sometimes split up a single line:

image

It should be

image

I think the issue is that either we or chroma are emitting newlines where there shouldn't be ones. Here's the raw HTML of line 2 line with three newlines present on a single actual line:

<span class="mono wrap">	npx ver 
<span class="added-code"><span class="err">-</span><span class="err">C</span> 
</span><span class="err">p</span><span class="err">a</span><span class="err">t</span><span class="err">c</span><span class="err">h</span>
</span>

cc: @mrsdizzie

Originally created by @silverwind on GitHub (Jul 7, 2020). Example: https://try.gitea.io/silverwind/updates/commit/03967f99a6cbb87c7ea7385d264ed42539b0162f https://github.com/go-gitea/gitea/pull/12047 seems to cause text in diffs to sometimes split up a single line: <img width="301" alt="image" src="https://user-images.githubusercontent.com/115237/86749618-ad39b600-c03d-11ea-8cd5-1930e8940194.png"> It should be <img width="313" alt="image" src="https://user-images.githubusercontent.com/115237/86749919-e3773580-c03d-11ea-9fe5-9f5843054616.png"> I think the issue is that either we or chroma are emitting newlines where there shouldn't be ones. Here's the raw HTML of line 2 line with three newlines present on a single actual line: ```` <span class="mono wrap"> npx ver <span class="added-code"><span class="err">-</span><span class="err">C</span> </span><span class="err">p</span><span class="err">a</span><span class="err">t</span><span class="err">c</span><span class="err">h</span> </span> ```` cc: @mrsdizzie
GiteaMirror added the type/bug label 2025-11-02 06:33:30 -06:00
Author
Owner

@mrsdizzie commented on GitHub (Jul 7, 2020):

Hmm weird it does seem to be happening somewhere in Chroma in the tokenizing stage. Put up a PR to just remove the added newline

@mrsdizzie commented on GitHub (Jul 7, 2020): Hmm weird it does seem to be happening somewhere in Chroma in the tokenizing stage. Put up a PR to just remove the added newline
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#5700