diff --git a/appview/pages/pages.go b/appview/pages/pages.go index 1ca235b..81af1a2 100644 --- a/appview/pages/pages.go +++ b/appview/pages/pages.go @@ -73,6 +73,12 @@ func funcMap() template.FuncMap { "length": func(v []string) int { return len(v) }, + "splitN": func(s, sep string, n int) []string { + return strings.SplitN(s, sep, n) + }, + "unescapeHtml": func(s string) template.HTML { + return template.HTML(s) + }, } } diff --git a/appview/pages/templates/repo/blob.html b/appview/pages/templates/repo/blob.html index 62fbfd2..7ab17a6 100644 --- a/appview/pages/templates/repo/blob.html +++ b/appview/pages/templates/repo/blob.html @@ -18,5 +18,5 @@ {{ if .IsBinary }}
This is a binary file and will not be displayed.
{{ else }}{{ range $idx, $line := $lines }}
{{ add $idx 1 }}
- {{ $line }}{{ else }}this file is empty{{ end }}{{ end}}
+ {{ unescapeHtml $line }}{{ else }}this file is empty{{ end }}{{ end}}
{{ end }}
diff --git a/appview/pages/templates/repo/index.html b/appview/pages/templates/repo/index.html
index eefb81b..4b1e42d 100644
--- a/appview/pages/templates/repo/index.html
+++ b/appview/pages/templates/repo/index.html
@@ -51,7 +51,18 @@
before:top-1/2
before:-translate-y-1/2
">
-