gohugoio / hugo

The world’s fastest framework for building websites.
https://gohugo.io
Apache License 2.0
75.93k stars 7.54k forks source link

Improve Katex error handling #12749

Closed bep closed 3 months ago

bep commented 3 months ago

This enables constructs on the form:

{{ with transform.ToMath "c = \\foo{a^2 + b^2}" }}
    {{ with .Err }}
        {{ warnf "error: %s" . }}
    {{ else }}
        {{ . }}
    {{ end }}
{{ end }}

Note that the new Result type behaves like template.HTML (or a string if needed) when printed, but it will panic if in a error state.

Closes #12748