-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Full-file syntax highlighting for diff pages #33766
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…acing placing spans for changes and not syntax highlighting the code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
HTML encoding should be correctly handled, for example: <>
See new comment below #33766 (comment)
This comment was marked as outdated.
This comment was marked as outdated.
- reverting tests to be closer to original
… since we dont actually need to highlight the code here - adding newline in testcase
Thank you very much. I can understand most of changes now. The idea is feasible, while there are still some details:
|
Sounds acceptable to have a certain byte limit above which to fall back to hunk-based diff. Maybe 1-5MB or so. |
- adding conditions for when full file based highlighting should occur - falling back to hunk based highlighting in certain conditions - reverting original hunk-based highlighting tests - updating types to express intent better and to be more accurate i.e. `template.HTML` instead of string where appropriate
When expend more codes, it result in 500
|
Fixed in b2dbc78 and added more tests |
* giteaofficial/main: Move notifywatch to service layer (go-gitea#33825) [skip ci] Updated translations via Crowdin Only keep popular licenses (go-gitea#33832) Removing unwanted ui container (go-gitea#33833) Full-file syntax highlighting for diff pages (go-gitea#33766) Improve theme display (go-gitea#30671) Decouple context from repository related structs (go-gitea#33823) Improve log format (go-gitea#33814) Decouple diff stats query from actual diffing (go-gitea#33810) Add global lock for migrations to make upgrade more safe with multiple replications (go-gitea#33706) Do not show passkey on http sites (go-gitea#33820)
Follow up fix: Fix material icon & diff highlight #33844 |
Fix go-gitea#33358, fix go-gitea#21970 This adds a step in the `GitDiffForRender` that does syntax highlighting for the entire file and then only references lines from that syntax highlighted code. This allows things like multi-line comments to be syntax highlighted correctly. --------- Co-authored-by: wxiaoguang <[email protected]> (cherry picked from commit 3f1f808)
Fix #33358, fix #21970
This adds a step in the
GitDiff
that does syntax highlighting for the entire file and then only references lines from that syntax highlighted code. This allows things like multi-line comments to be syntax highlighted correctly.