Skip to content

Funky spaces in yaml syntax highlighting #33141

Closed
@DrMaxNix

Description

@DrMaxNix

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions