Whitespace formatting on code view #9214

Closed
opened 2025-11-02 08:32:21 -06:00 by GiteaMirror · 1 comment
Owner

Originally created by @sarandafl on GitHub (Jul 12, 2022).

Description

When viewing files in the web viewer (tried with .go, .json, .yml) the whitespace is not displayed properly.
See blow YAML for example:

http:
--
  | routers:
  | router-kb:
  | entryPoints:
  | - "web"
  | - "websecure"
  | rule: "Host(`kb.internal.example.com`)"
  | service: "kb"
  | tls:
  | certResolver: subca
  | services:
  | kb:
  | loadBalancer:
  | servers:
  | - url: "http://site.internal.example.com:3000"

When viewing the raw file it is displayed as expected:

http:
  routers:
    router-kb:
      entryPoints:
        - "web"
        - "websecure"
      rule: "Host(`kb.internal.example.com`)"
      service: "kb"
      tls:
        certResolver: subca
  services:
    kb:
      loadBalancer:
        servers:
        - url: "http://site.internal.example.com:3000"

When on the go/on mobile it would be nice to see the files with proper whitespace formatting instead of switching to the raw view.

I noticed on the demo site it seems to be working. I pasted the content of the raw file directly into a new YAML file using the web editor. Once saving and viewing the file the formatting is correct. On the selfhosted version this doesn't work (at least on mine). I checked the network requests using dev tools and didn't see any blocked files or warnings in the console.

Screenshots

gitea

Gitea Version

1.16.8

Can you reproduce the bug on the Gitea demo site?

No

Operating System

CentOS 8 Stream

Browser Version

Version 1.38.109 Chromium: 101.0.4951.41 (Official Build) (x86_64)

Originally created by @sarandafl on GitHub (Jul 12, 2022). ### Description When viewing files in the web viewer (tried with `.go`, `.json`, `.yml`) the whitespace is not displayed properly. See blow YAML for example: ``` http: --   | routers:   | router-kb:   | entryPoints:   | - "web"   | - "websecure"   | rule: "Host(`kb.internal.example.com`)"   | service: "kb"   | tls:   | certResolver: subca   | services:   | kb:   | loadBalancer:   | servers:   | - url: "http://site.internal.example.com:3000" ``` When viewing the raw file it is displayed as expected: ``` http: routers: router-kb: entryPoints: - "web" - "websecure" rule: "Host(`kb.internal.example.com`)" service: "kb" tls: certResolver: subca services: kb: loadBalancer: servers: - url: "http://site.internal.example.com:3000" ``` When on the go/on mobile it would be nice to see the files with proper whitespace formatting instead of switching to the raw view. I noticed on the demo site it seems to be working. I pasted the content of the raw file directly into a new YAML file using the web editor. Once saving and viewing the file the formatting is correct. On the selfhosted version this doesn't work (at least on mine). I checked the network requests using dev tools and didn't see any blocked files or warnings in the console. ### Screenshots <img width="1680" alt="gitea" src="https://user-images.githubusercontent.com/17392375/178564714-676a2837-b3af-4b24-8c41-0f49df5a6e0f.png"> ### Gitea Version 1.16.8 ### Can you reproduce the bug on the Gitea demo site? No ### Operating System CentOS 8 Stream ### Browser Version Version 1.38.109 Chromium: 101.0.4951.41 (Official Build) (x86_64)
GiteaMirror added the issue/not-a-bugissue/duplicate labels 2025-11-02 08:32:21 -06:00
Author
Owner

@zeripath commented on GitHub (Jul 12, 2022):

Turn off cloudfare's minimization.

@zeripath commented on GitHub (Jul 12, 2022): Turn off cloudfare's minimization.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#9214