Skip to content

Conversation

@kama-pa-go
Copy link
Contributor

This merge integrates MathJax directly into the application using Webpack, removing the dependency on CloudFlare CDN. This ensures the platform is fully functional in offline deployment scenarios.

Key changes:

Added mathjax (v2.7) to package.json and configured CopyPlugin in Webpack to serve assets locally from dist_webpack.
Updated settings.py to point MATHJAX_LOCATION to local static files.
Injected inline MathJax configuration in base.html to enable single-dollar ($) delimiters for inline math, which were previously unsupported by the default CDN configuration.
Added dist_webpack to STATICFILES_DIRS to allow Django to discover the new assets.
Upgraded MatJax to the latest 4.0.0 version.

Closes #44
Relate to #586

MathJax 2.x relies on dynamic asset loading (fonts, configs) and cannot be bundled into a single JS file. We added copy-webpack-plugin to copy the library files intact from node_modules to the static directory, enabling offline functionality.

Relate to sio2project#44
This change adds CopyPlugin to move the library from node_modules to static files, enabling offline support.

Relate to sio2project#44
Updated `MATHJAX_LOCATION` to point to local static files instead of external CDN, enabling offline usage.
Added `dist_webpack` to `STATICFILES_DIRS` to ensure Django can serve assets copied by Webpack.
Injected inline MathJax configuration in `base.html` to explicitly enable single-dollar ($) delimiters, as the default configuration disables them.

Relate to sio2project#44
…st 4.x beta. This modernizes the math rendering engine, improving performance, accessibility, and loading times.

Key changes:
- Updated `package.json` to install `mathjax@4`.
- Modified `webpack.config.js` to copy the new MathJax distribution structure (excluding source files) to `dist_webpack`.
- Updated `settings.py` to point `MATHJAX_LOCATION` to the new entry point (`tex-chtml.js`).
- Refactored `base.html` configuration to use the new `window.MathJax` object API.
- Enabled single-dollar (`$`) delimiters for inline math to maintain backward compatibility with existing problem statements.
- Added `tex2jax_ignore/process` class mappings to ensure legacy content with specific ignore classes still renders correctly.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Stop using CDNs

1 participant