Replies are plain text, so a model asked about an integral answers with \int_0^1 x^2 dx and the reader gets the source. KaTeX is vendored into the binary rather than loaded from a CDN. This gateway makes no outbound requests of its own and is expected to run where it could not make one; a chat page that silently loses its maths on an air-gapped cluster would be worse than one that never had it. 600 KB of JS, CSS and WOFF2 fonts, which the stripped binary absorbs without changing its rounded size. The ordering is the safety argument, and there is a test for it rather than a comment alone. The reply is put in place with textContent exactly as before, and only then walked for maths: renderMathInElement replaces the spans it recognises, so nothing the model wrote is ever parsed as HTML and the markup that appears is KaTeX's. trust stays false — KaTeX's default, and what keeps \href and \includegraphics out of a reply — and throwOnError is off so one malformed expression does not take the rest with it. Rendered once the reply is complete. Typesetting each chunk would try to set half an expression on every token and flicker through the whole answer. The static handler now serves a small embedded asset tree rather than one file, so it moved to its own embed: a file server over the tree that also carries the templates would serve those too. Directory listings are refused — nothing links to one, so the only requests are from somebody looking around. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
27 lines
1.2 KiB
Plaintext
27 lines
1.2 KiB
Plaintext
KaTeX 0.16.11 — https://katex.org — MIT License
|
|
Copyright (c) 2013-2020 Khan Academy and other contributors
|
|
|
|
Vendored rather than loaded from a CDN. This gateway makes no outbound requests
|
|
of its own and is expected to run on networks that cannot reach one; a chat page
|
|
that silently loses its maths on an air-gapped cluster would be worse than one
|
|
that never had it.
|
|
|
|
Taken unmodified from the npm tarball katex-0.16.11.tgz:
|
|
dist/katex.min.js
|
|
dist/katex.min.css
|
|
dist/contrib/auto-render.min.js
|
|
dist/fonts/*.woff2
|
|
|
|
Only the WOFF2 fonts are included; the CSS also lists WOFF and TTF sources,
|
|
which will 404. Every browser released since about 2016 takes the WOFF2 and
|
|
never asks for the others, and carrying three copies of the same fonts would
|
|
triple the 300 KB this costs.
|
|
|
|
To update: fetch the tarball, replace these files, and check that
|
|
TestMathIsRenderedWithoutTrustingTheModel still passes — KaTeX's `trust` option
|
|
defaults to false, and that default is what keeps \href and friends out of model
|
|
output.
|
|
7b57d427ac6270677daf8d8380ded2cc73336f9149a167b8e1fe0d6ef66604ae auto-render.min.js
|
|
e6bfe5deebd4c7ccd272055bab63bd3ab2c73b907b6e6a22d352740a81381fd4 katex.min.js
|
|
717bc9ae7853b61f0f76455dddf0ecd4f527a783f42de2ac24684899c1c46258 katex.min.css
|