Closed
Description
Currently, if the KaTex strict mode is warn
, we throw an error regardless of error code:
execute of template failed at <transform.ToMath>: error calling ToMath: not a function
Instead, we should capture and display the warnings as described in the KaTeX documentation. There are some related comments in the code:
Lines 455 to 459 in e25db38
This isn't a pressing issue in that #13736 changed the default strict mode from "warn" to "error", and we have not documented "warn" mode.
Notes:
- The "not a function" message comes from here (i.e.,
e.message
is "not a function"):
hugo/internal/warpc/js/common.js
Line 55 in f471936
- This is an educated guess, but I think if the user sets
strict
towarn
, we have to pass in a JS function (instead ofwarn
) that somehow captures an error (without throwing one) instead of calling console.warn. See https://katex.org/docs/error. If my guess is correct, this is a bit ugly and probably not worth the effort. - I've looked at this for a few hours and have no idea how to approach it.