diff --git a/docs/content/en/functions/transform/Plainify.md b/docs/content/en/functions/transform/Plainify.md index 040145170b8..681d41f72e2 100644 --- a/docs/content/en/functions/transform/Plainify.md +++ b/docs/content/en/functions/transform/Plainify.md @@ -6,7 +6,7 @@ keywords: [] action: aliases: [plainify] related: [] - returnType: string + returnType: template.HTML signatures: [transform.Plainify INPUT] aliases: [/functions/plainify] --- diff --git a/tpl/transform/transform.go b/tpl/transform/transform.go index db7703b7fb5..78346c0e608 100644 --- a/tpl/transform/transform.go +++ b/tpl/transform/transform.go @@ -188,18 +188,18 @@ func (ns *Namespace) Markdownify(ctx context.Context, s any) (template.HTML, err } // Plainify returns a copy of s with all HTML tags removed. -func (ns *Namespace) Plainify(s any) (string, error) { +func (ns *Namespace) Plainify(s any) (template.HTML, error) { ss, err := cast.ToStringE(s) if err != nil { return "", err } - return tpl.StripHTML(ss), nil + return template.HTML(tpl.StripHTML(ss)), nil } // ToMath converts a LaTeX string to math in the given format, default MathML. // This uses KaTeX to render the math, see https://katex.org/. -func (ns *Namespace) ToMath(ctx context.Context, args ...any) (string, error) { +func (ns *Namespace) ToMath(ctx context.Context, args ...any) (template.HTML, error) { if len(args) < 1 { return "", errors.New("must provide at least one argument") }