mirror of
https://github.com/go-gitea/gitea
synced 2025-07-19 16:58:37 +00:00
Full-file syntax highlighting for diff pages (#33766)
Fix #33358, fix #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 <wxiaoguang@gmail.com>
This commit is contained in:
@@ -1591,8 +1591,7 @@ func GetPullRequestFiles(ctx *context.APIContext) {
|
||||
maxLines := setting.Git.MaxGitDiffLines
|
||||
|
||||
// FIXME: If there are too many files in the repo, may cause some unpredictable issues.
|
||||
// FIXME: it doesn't need to call "GetDiff" to do various parsing and highlighting
|
||||
diff, err := gitdiff.GetDiff(ctx, baseGitRepo,
|
||||
diff, err := gitdiff.GetDiffForAPI(ctx, baseGitRepo,
|
||||
&gitdiff.DiffOptions{
|
||||
BeforeCommitID: startCommitID,
|
||||
AfterCommitID: endCommitID,
|
||||
|
Reference in New Issue
Block a user