mirror of
https://github.com/go-gitea/gitea.git
synced 2026-08-07 15:32:11 +00:00
refactor: render highlight language (#38793)
Avoid CSS injection More details are in the comment of CodeBlockAttributes
This commit is contained in:
@@ -90,7 +90,7 @@ To make template code maintainable:
|
||||
|
||||
- Go code should take over complex logic and prepare template data as much as possible, templates only render the data.
|
||||
- Prefer struct types provided by Go code instead of map types for template data.
|
||||
- Avoid using single world names for non-local variables.
|
||||
- Avoid using single word names for non-local variables.
|
||||
- Avoid passing `"root" $` or `"." .` to sub-templates, instead pass the specific data needed by the sub-template.
|
||||
- Use explicit variable names instead of `.` to access data: ``{{range $item := $.TargetItems}}{{ $item.Name }}{{end}}``
|
||||
- Use Go code to implement render helpers if the render logic is too complex.
|
||||
|
||||
Reference in New Issue
Block a user