Funky spaces in yaml syntax highlighting #13928

Closed
opened 2025-11-02 10:57:31 -06:00 by GiteaMirror · 2 comments
Owner

Originally created by @DrMaxNix on GitHub (Jan 7, 2025).

Description

For yaml files, the code viewer (yaml files as well as yaml code blocks in markdown) shows spaces at the end of the last line in multi-line values. These are NOT present in the source file, but for some reason they appear in the code viewer.
Sounds funny at first but becomes a hassle pretty quickly if you copy code from the browser window into your project. Now you have a lot of funky spaces that are REALLY there.

Reproduce

  1. In a (fresh) gitea repo, create a file spaces-from-space.yaml with following content:
test: |
  multi
  line
bla: "blub"
  1. Push the file to the repo
  2. In the Gitea UI, navigate to that file and click on the "Raw" button
  3. Now convince yourself one more time that there indeed is no space after the 3rd line
  4. Go back to the file view
  5. Select the 3rd code line with your mouse and see that there are spaces at the end of the line!

More proofs of concept

Also happens with markdown inline yaml: https://git.tjdev.de/DrMaxNix/snippets/src/branch/main/spaces-from-space.md

Gitea Version

v1.22.6

Can you reproduce the bug on the Gitea demo site?

No (registration disabled lol)

Screenshots

How are you running Gitea?

self built binary

Originally created by @DrMaxNix on GitHub (Jan 7, 2025). ### Description For yaml files, the code viewer (yaml files as well as yaml code blocks in markdown) shows spaces at the end of the last line in multi-line values. These are NOT present in the source file, but for some reason they appear in the code viewer. Sounds funny at first but becomes a hassle pretty quickly if you copy code from the browser window into your project. Now you have a lot of funky spaces that are REALLY there. ### Reproduce 1. In a (fresh) gitea repo, create a file `spaces-from-space.yaml` with following content: ```yaml test: | multi line bla: "blub" ``` 2. Push the file to the repo 3. In the Gitea UI, navigate to that file and click on the "Raw" button 4. Now convince yourself one more time that there indeed is no space after the 3rd line 5. Go back to the file view 6. Select the 3rd code line with your mouse and see that there are spaces at the end of the line! ### More proofs of concept Also happens with markdown inline yaml: https://git.tjdev.de/DrMaxNix/snippets/src/branch/main/spaces-from-space.md ### Gitea Version v1.22.6 ### Can you reproduce the bug on the Gitea demo site? No (registration disabled lol) ### Screenshots <img src="https://github.com/user-attachments/assets/3b0dee67-e245-4663-abd5-29f3f4272bbe" /> <img src="https://github.com/user-attachments/assets/623e1f8d-ed0f-4846-80c4-95629800eb7d" /> ### How are you running Gitea? self built binary
GiteaMirror added the type/bug label 2025-11-02 10:57:31 -06:00
Author
Owner

@wxiaoguang commented on GitHub (Jan 8, 2025):

Will fix it

@wxiaoguang commented on GitHub (Jan 8, 2025): Will fix it
Author
Owner

@wxiaoguang commented on GitHub (Jan 8, 2025):

It is the chroma (depdendency)'s bug, updating it to latest fixes the problem.

@wxiaoguang commented on GitHub (Jan 8, 2025): It is the chroma (depdendency)'s bug, updating it to latest fixes the problem. * for main branch: #33136 * for 1.23: #33133
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#13928