Skip to content

Syntax highlighting should be full-file only #33358

Closed
@silverwind

Description

@silverwind

Description

Diff lines are passed individually line-by-line to chroma, which its a massive source of highlighting bugs because the highlighter needs to see the whole file to highlight correctly. We should instead:

  • Highlight both the old and new files individually, store the resulting HTML in Maps of (lineText, lineHTML).
  • For each content line in the diff, look into the maps and if there is an exact match, replace the line with the highlighted HTML line.

This assumes chroma does not output HTML tags that span multiple lines, but I think this may already be the case.

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic/content-renderingChanges how certain filetypes are displayedtopic/uiChange the appearance of the Gitea UItype/bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions