KaTeX: drop js script files, use build-time rendering instead#2276
KaTeX: drop js script files, use build-time rendering instead#2276chalin merged 5 commits intogoogle:mainfrom
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR simplifies KaTeX handling by dropping the client‐side JavaScript files in favor of Hugo’s embedded, server‐side rendering engine, which improves performance and reduces configuration complexity.
- Removed manual activation and configuration instructions from documentation
- Eliminated JS script loading for KaTeX and its auto-render/mhchem extensions
- Updated render templates for math and chemical code blocks to use transform.ToMath
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| userguide/content/en/docs/adding-content/diagrams-and-formulae/index.md | Documentation updated to reflect server-side rendering and removal of manual activation. |
| layouts/_partials/scripts/katex.html | Removed JS loading for KaTeX, now only loads stylesheet since rendering is done server side. |
| layouts/_partials/scripts.html | Updated condition to load the KaTeX partial based on server-rendering flags. |
| layouts/_markup/render-passthrough.html | Updated to use transform.ToMath for math rendering. |
| layouts/_markup/render-codeblock-math.html | Simplified math block rendering using transform.ToMath. |
| layouts/_markup/render-codeblock-chem.html | Simplified chemical rendering using transform.ToMath. |
| CHANGELOG.md | Changelog updated to explain the new server side rendering behavior. |
baa3628 to
20e2b62
Compare
chalin
left a comment
There was a problem hiding this comment.
Great news about the simplification! Thanks.
Could you update the PR (including the title) to say that this is build-time rendering, not server-side.
In terms of code style for this repo, please favor tail-end whitespace globing using -}} and drop the {{- when it is unnecessary -- which is most of the time. Thanks.
I'll take a closer review as soon as I can.
7d947c2 to
4d21a43
Compare
You are welcome!
Done.
Changed as requested.
Looking forward receiving your review soon! |
4bfb912 to
e1cbac5
Compare
|
Thanks for your thorough review, all changes are incorporated, checkers are green. |
e1cbac5 to
606aa26
Compare
Great! Will get back to you as soon as I can for the next round of review. |
|
Marvelous |
39fdc87 to
91a9b9f
Compare
da070ba to
0681309
Compare
We'll be putting out a new release (0.13.0) soon. |
This PR fixes #2270.
With > 300 lines dropped (user guide + scripts), this PR significantly simplifies the documentation and the code base for KaTeX handling. This PR brings several advantages to the user:
mhchemextension is included in Hugo's embedded KaTeX engine as of v.0.144.0. No need for activation or configuration ofmhchemextension inside the config file any more.Preview: https://deploy-preview-2276--docsydocs.netlify.app/docs/adding-content/diagrams-and-formulae/