Skip to content

Handle KaTeX warnings #13760

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
May 30, 2025
Merged

Handle KaTeX warnings #13760

merged 4 commits into from
May 30, 2025

Conversation

bep
Copy link
Member

@bep bep commented May 29, 2025

Fix #13735

@bep bep force-pushed the fix/katexwarntake2-13735 branch 2 times, most recently from e8f2444 to c523cac Compare May 29, 2025 11:36
@bep bep requested a review from jmooring May 29, 2025 12:55
@bep bep force-pushed the fix/katexwarntake2-13735 branch from c523cac to c7d1ac5 Compare May 29, 2025 13:22
@bep bep force-pushed the fix/katexwarntake2-13735 branch from c7d1ac5 to 15c60f1 Compare May 29, 2025 13:23
Copy link
Member

@jmooring jmooring left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jmooring
Copy link
Member

jmooring commented May 29, 2025

Please hold off on merging this for a bit. I found something related to the (unexpected) way that KaTeX handles the newLineInDisplayMode error.

Note to self, again: disable cache.misc while testing.

See https://discourse.gohugo.io/t/newline-problem-with-transform-tomath/54833 for newLineInDisplayMode error example.

@bep
Copy link
Member Author

bep commented May 29, 2025

@jmooring Feel free to push to this PR (or if needed, just take my branch and create a new PR).

@jmooring
Copy link
Member

When strict is set to warn, the warning appears the first time you build, but once the result is cached the warning does not appear again. When we retrieve the cached result in future builds, we have no idea if warnings were emitted during the initial run.

This is certainly solvable (e.g., caching a struct in a gob, caching JSON, etc.), but I'm not sure it's worth the effort.

Unless there's a low-effort way to handle this, I think limiting the strict options to error (the default) and ignore is good enough.

@bep
Copy link
Member Author

bep commented May 30, 2025

@jmooring have a look at my last commit.

@bep bep force-pushed the fix/katexwarntake2-13735 branch from b74c951 to 659a88f Compare May 30, 2025 08:09
@jmooring
Copy link
Member

This works really well. Ready to squash and merge when tests go green. Thanks.

@bep bep merged commit 6334948 into gohugoio:master May 30, 2025
6 checks passed
@bep
Copy link
Member Author

bep commented May 30, 2025

@jmooring I didn't know that the placment of the "co author" line mattered when squashing mattered, but now I know.

@jmooring
Copy link
Member

@bep On the list of things that concern me, this is number 4374.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

tpl/transform: Capture and display warnings when KaTeX strict mode is warn
2 participants