[PR #1829] [CLOSED] Add shared LaTeX/web math core without a rendering engine #3705

Closed
opened 2026-11-07 15:30:12 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/1829
Author: @CC-David-CC
Created: 10/10/2026
Status: ❌ Closed

Base: main ← Head: feat/web-math-common


📝 Commits (3)

  • 56063f3 web: isolate shared chat math foundation and adapter contract
  • 253ea8c Merge remote-tracking branch 'upstream/main' into HEAD
  • 4010abe Merge Strata v0.1.43 into feat/web-math-common

📊 Changes

9 files changed (+408 additions, -4 deletions)

View changed files

➕ docs/WEB_MATH_INTERFACE.md (+22 -0)
➕ serve/fixtures/math.json (+12 -0)
📝 serve/server.py (+18 -0)
📝 serve/web/app.css (+8 -0)
📝 serve/web/app.js (+18 -4)
📝 serve/web/index.html (+4 -0)
➕ serve/web/math-adapter.js (+6 -0)
➕ serve/web/math.js (+113 -0)
➕ tools/test_web_math.py (+207 -0)

📄 Description

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. The full browser acceptance suite requires a real implementation adapter; this foundation deliberately does not typeset equations.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Niko1221/Strata/pull/1829 **Author:** [@CC-David-CC](https://github.com/CC-David-CC) **Created:** 10/10/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `feat/web-math-common` --- ### 📝 Commits (3) - [`56063f3`](https://github.com/Niko1221/Strata/commit/56063f315e3975294e67ac4f9e40ef7cd5a6a5c4) web: isolate shared chat math foundation and adapter contract - [`253ea8c`](https://github.com/Niko1221/Strata/commit/253ea8cfe554f45f1a0ca287b9880363d3b16012) Merge remote-tracking branch 'upstream/main' into HEAD - [`4010abe`](https://github.com/Niko1221/Strata/commit/4010abec43d4b2307ff0c8cac3604af2868bf9fe) Merge Strata v0.1.43 into feat/web-math-common ### 📊 Changes **9 files changed** (+408 additions, -4 deletions) <details> <summary>View changed files</summary> ➕ `docs/WEB_MATH_INTERFACE.md` (+22 -0) ➕ `serve/fixtures/math.json` (+12 -0) 📝 `serve/server.py` (+18 -0) 📝 `serve/web/app.css` (+8 -0) 📝 `serve/web/app.js` (+18 -4) 📝 `serve/web/index.html` (+4 -0) ➕ `serve/web/math-adapter.js` (+6 -0) ➕ `serve/web/math.js` (+113 -0) ➕ `tools/test_web_math.py` (+207 -0) </details> ### 📄 Description 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. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-07 15:30:12 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#3705
No description provided.