Refactor code render and render control chars (#37078)

Fix #37057
This commit is contained in:
wxiaoguang
2026-04-03 12:10:01 +08:00
committed by GitHub
parent 7b17234945
commit 6eed75af24
8 changed files with 173 additions and 97 deletions
+1 -5
View File
@@ -119,12 +119,8 @@ func handleFileViewRenderSource(ctx *context.Context, attrs *attribute.Attribute
}
language := attrs.GetLanguage().Value()
fileContent, lexerName, err := highlight.RenderFullFile(filename, language, buf)
fileContent, lexerName := highlight.RenderFullFile(filename, language, buf)
ctx.Data["LexerName"] = lexerName
if err != nil {
log.Error("highlight.RenderFullFile failed, fallback to plain text: %v", err)
fileContent = highlight.RenderPlainText(buf)
}
status := &charset.EscapeStatus{}
statuses := make([]*charset.EscapeStatus, len(fileContent))
for i, line := range fileContent {