Make all renderhook Text methods return template.HTML

This commit is contained in:
Bjørn Erik Pedersen
2024-08-31 17:25:15 +02:00
parent f738669a4d
commit 6d97ee711e
13 changed files with 50 additions and 36 deletions

View File

@@ -98,8 +98,8 @@ baseURL="https://example.org"
P1: {{ $p.Content }}
`,
"_default/_markup/render-link.html", `html-link: {{ .Destination | safeURL }}|Text: {{ .Text | safeHTML }}|Plain: {{ .PlainText | safeHTML }}`,
"_default/_markup/render-image.html", `html-image: {{ .Destination | safeURL }}|Text: {{ .Text | safeHTML }}|Plain: {{ .PlainText | safeHTML }}`,
"_default/_markup/render-link.html", `html-link: {{ .Destination | safeURL }}|Text: {{ .Text }}|Plain: {{ .PlainText | safeHTML }}`,
"_default/_markup/render-image.html", `html-image: {{ .Destination | safeURL }}|Text: {{ .Text }}|Plain: {{ .PlainText | safeHTML }}`,
)
b.WithContent("p1.md", `---

View File

@@ -928,7 +928,7 @@ func (c *cachedContentScope) RenderString(ctx context.Context, args ...any) (tem
contentToRenderv := args[sidx]
if _, ok := contentToRenderv.(hstring.RenderedString); ok {
if _, ok := contentToRenderv.(hstring.RenderedHTML); ok {
// This content is already rendered, this is potentially
// a infinite recursion.
return "", errors.New("text is already rendered, repeating it may cause infinite recursion")