Fix custom CSS

This commit is contained in:
r 2022-05-10 17:25:58 +00:00
parent 471701f029
commit 4ad71587d8
2 changed files with 6 additions and 1 deletions

View file

@ -129,6 +129,10 @@ func raw(s string) template.HTML {
return template.HTML(s)
}
func rawCSS(s string) template.CSS {
return template.CSS(s)
}
type Renderer interface {
Render(ctx *Context, writer io.Writer, page string, data interface{}) (err error)
}
@ -150,6 +154,7 @@ func NewRenderer(templateGlobPattern string) (r *renderer, err error) {
"WithContext": withContext,
"HTML": template.HTMLEscapeString,
"Raw": raw,
"RawCSS": rawCSS,
}).ParseGlob(templateGlobPattern)
if err != nil {
return

View file

@ -26,7 +26,7 @@
<script src="/static/fluoride.js"></script>
{{end}}
{{if $.Ctx.UserCSS}}
<style>{{$.Ctx.UserCSS}}</style>
<style>{{RawCSS $.Ctx.UserCSS}}</style>
{{end}}
</head>
<body {{if $.Ctx.DarkMode}}class="dark"{{end}}>