贡献 / #1829

#1829 Add shared LaTeX/web math core without a rendering engine

open · @CC-David-CC · 0 评论 · 去 GitHub 看

Documentation

说明

Adds the shared web chat integration for future math renderers. **This PR contains no viewer, typesetting engine, fonts, or TeX compiler.** The placeholder adapter reports unavailable and leaves equations as readable source. Related to #1769 and #1780; rendering support will come in separate follow-up PRs.

- Adds an opt-in **Render math** setting, disabled by default. With it disabled, assistant answers use the existing Markdown path.
- Recognizes inline `\(...\)` and conservative `$...$`, plus display `\[...\]` and `$$...$$`. Protects equation source before Markdown formatting and keeps code and currency literal.
- Preserves source for copying, Markdown export, saved history, and subsequent model requests. Handles streaming and ignores stale asynchronous results.
- Defines the renderer adapter contract, serialized conversion queue, 256-entry cache, 16 KiB UTF-8 input limit, initialization deadline, and asynchronous rendering deadline. Adds restricted same-origin asset serving for later bundled renderers.
- Includes the shared fixture corpus and browser acceptance suite. Separate KaTeX, MathJax, and isolated full TeX branches supply the adapters and dependencies on top of this core.

Core smoke-tested in Chromium for default-off behavior, unavailable-engine source fallback, persistence, API source preservation, and disabling round-trip without engine assets. The shared acceptance suite also passed on the KaTeX implementation in Chromium, Firefox, and Playwright WebKit. Timers cannot interrupt synchronous JavaScript; adapters must bound macro expansion. Macro isolation is an adapter requirement.

See [the interface and branch structure](https://github.com/CC-David-CC/Strata-a5500/blob/feat/web-math-common/docs/WEB_MATH_INTERFACE.md). The full browser acceptance suite requires a real implementation adapter; this foundation deliberately does not typeset equations.

本站相关内容

相关页面的快捷入口。