Commit da39c71
Self-host MathJax via @prosemark/latex vite plugin (url-import) (#150)
* Use top-level static MathJax import in LaTeX webview
Replace deferred dynamic imports with a build-time side-effect import of
mathjax/tex-svg.js (peer dependency of @prosemark/latex) so Vite fully
bundles MathJax into webview.js before the webview loads.
Co-authored-by: J. Simon Richard <jsimonrichard@gmail.com>
* Keep latex setup handler async for readability
Co-authored-by: J. Simon Richard <jsimonrichard@gmail.com>
* Disable MathJax a11y speech worker in VS Code webview
The tex-svg combined component loads sre/speech-worker.js at runtime, but
Vite only emits webview.js. Turn off speech/enrichment for editor preview.
Co-authored-by: J. Simon Richard <jsimonrichard@gmail.com>
* Copy MathJax sre assets into webview dist via Vite plugin
The tex-svg bundle loads sre/speech-worker.js at runtime as a web worker.
Vite inlines the main IIFE but cannot bundle workers loaded via importScripts,
so copy mathjax/sre/ next to webview.js after each build.
Co-authored-by: J. Simon Richard <jsimonrichard@gmail.com>
* Add @prosemark/latex vite-plugin-mathjax and self-host MathJax
Export copyMathJaxAssets from @prosemark/latex/vite-plugin-mathjax with a
configurable copy list (default tex-svg.js + sre). The LaTeX VS Code webview
loads MathJax via url-import from dist/webview/mathjax/ instead of bundling
tex-svg into webview.js (~48 KB vs ~1.8 MB).
Co-authored-by: J. Simon Richard <jsimonrichard@gmail.com>
* Keep latex setup handler async
Co-authored-by: J. Simon Richard <jsimonrichard@gmail.com>
* Fix MathJax URL resolution when multiple webview scripts load
mathJaxPackageUrlFromWebviewScript used the last script tag, which was
cspell-integration's webview.js when both companions are installed.
Add scriptSrcIncludes and use latex-integration in the LaTeX webview.
Co-authored-by: J. Simon Richard <jsimonrichard@gmail.com>
* Pass MathJax package URL from extension host via asWebviewUri
Extend SubExtensionCallback with the webview instance so sub-extensions
can resolve local resource URLs with webview.asWebviewUri instead of
reverse-engineering script tags in the webview.
The LaTeX integration now passes mathJaxPackageUrl into setup from the
extension host, removing the scriptSrcIncludes workaround.
Co-authored-by: J. Simon Richard <jsimonrichard@gmail.com>
* Remove mathJaxPackageUrlFromWebviewScript from @prosemark/latex
VS Code integrations should pass mathJaxPackageUrl from the extension
host via webview.asWebviewUri; script-tag discovery is no longer needed.
Co-authored-by: J. Simon Richard <jsimonrichard@gmail.com>
* Pass SubExtensionCallback context as a single object
Sub-extension factories now receive { document, callProcAndForget,
callProcWithReturnValue, webview } so each integration can destructure
only what it needs without breaking when new fields are added.
Co-authored-by: J. Simon Richard <jsimonrichard@gmail.com>
* Document MathJax a11y/speech worker options for static-import
Explain that tex-svg loads sre/speech-worker.js separately, and that
static-import setups must either disable a11y or copy and serve sre/.
Co-authored-by: J. Simon Richard <jsimonrichard@gmail.com>
* Fix strict lint issues in latex package and extension
Use a type guard for the webview vscode API instead of an unsafe cast,
tighten the MathJax loader test helper, and include vite.config.mts in
eslint file patterns.
Co-authored-by: J. Simon Richard <jsimonrichard@gmail.com>
* Fix MathJax 4 config: use startup.typeset instead of skipStartupTypeset
MathJax 4 removed skipStartupTypeset; use startup.typeset: false to skip
automatic page typesetting. Update @prosemark/latex preconfiguration, docs,
and tests accordingly.
Co-authored-by: J. Simon Richard <jsimonrichard@gmail.com>
* Revert vite.config.mts in latex-integration eslint files list
vite.config.mts is git-tracked source, but sibling VS Code extensions do not
list their vite configs in eslint.config.ts and lint passes without it.
Co-authored-by: J. Simon Richard <jsimonrichard@gmail.com>
* Docs: drop unsupported claim that editor preview typically skips a11y
The VS Code extension keeps speech support via url-import and copied sre/.
Frame disabling a11y as a static-import tradeoff, not a preview default.
Co-authored-by: J. Simon Richard <jsimonrichard@gmail.com>
* Changeset: use patch bumps while packages are 0.x
Co-authored-by: J. Simon Richard <jsimonrichard@gmail.com>
* Changeset: drop startup.typeset note (introduced in this PR)
Co-authored-by: J. Simon Richard <jsimonrichard@gmail.com>
* Changeset: document pre-0.0.2 VS Code math rendering regression
Co-authored-by: J. Simon Richard <jsimonrichard@gmail.com>
* Changeset: split per package and fix VS Code regression wording
Describe the 0.0.2 bug as math failing when MathJax was bundled into
the extension; drop the speech-worker cause (introduced in this PR).
Co-authored-by: J. Simon Richard <jsimonrichard@gmail.com>
* Changeset: describe VS Code math bug as blocked CDN access
Co-authored-by: J. Simon Richard <jsimonrichard@gmail.com>
* Changeset: emphasize webview in integrator callback context
Co-authored-by: J. Simon Richard <jsimonrichard@gmail.com>
* Fix LaTeX math rendering in VS Code webview
Self-host MathJax in the extension to resolve rendering issues.
---------
Co-authored-by: Cursor Agent <cursoragent@cursor.com>1 parent d41f8e0 commit da39c71
24 files changed
Lines changed: 335 additions & 166 deletions
File tree
- .changeset
- apps
- docs/src/content/docs/guides
- vscode-extensions
- core/src/sub-extensions
- cspell-integration/src
- latex-integration
- src
- webview
- packages
- latex
- lib
- tests
- vscode-extension-integrator
- lib
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
79 | | - | |
| 79 | + | |
80 | 80 | | |
81 | 81 | | |
82 | 82 | | |
| |||
113 | 113 | | |
114 | 114 | | |
115 | 115 | | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
116 | 137 | | |
117 | 138 | | |
118 | 139 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
249 | 249 | | |
250 | 250 | | |
251 | 251 | | |
252 | | - | |
| 252 | + | |
253 | 253 | | |
254 | 254 | | |
255 | 255 | | |
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
70 | | - | |
| 70 | + | |
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
151 | 151 | | |
152 | 152 | | |
153 | 153 | | |
154 | | - | |
| 154 | + | |
155 | 155 | | |
156 | 156 | | |
157 | 157 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
4 | 8 | | |
5 | | - | |
| 9 | + | |
6 | 10 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
3 | | - | |
0 commit comments