Migrate from MathJax to KaTeX #31

Open
Groupr wants to merge 17 commits from Katex_Swap into main
Groupr commented 2025-11-10 23:49:09 -05:00 (Migrated from git2.unturf.com)

Migrate from MathJax to KaTeX for math rendering

  • Replaced MathJax CDN with KaTeX (faster, lighter weight)
  • Renamed all mathjax references to katex throughout codebase
  • Updated JavaScript to use KaTeX auto-render instead of MathJax.Hub
  • Created database migration to rename mathjax column to katex
  • Updated form handlers, templates, models, and tests
  • KaTeX renders client-side from CDN (no Python dependencies)
  • Math equations use same syntax: ... for display, ... for inline
Migrate from MathJax to KaTeX for math rendering - Replaced MathJax CDN with KaTeX (faster, lighter weight) - Renamed all mathjax references to katex throughout codebase - Updated JavaScript to use KaTeX auto-render instead of MathJax.Hub - Created database migration to rename mathjax column to katex - Updated form handlers, templates, models, and tests - KaTeX renders client-side from CDN (no Python dependencies) - Math equations use same syntax: $$...$$ for display, $...$ for inline
Groupr commented 2025-11-10 23:49:09 -05:00 (Migrated from git2.unturf.com)

requested review from @russellballestrini

requested review from @russellballestrini
russellballestrini commented 2025-11-11 09:10:22 -05:00 (Migrated from git2.unturf.com)

we need to make sure people who have mathjax enabled end up having katex enabled after the release instead.

we need to make sure people who have mathjax enabled end up having katex enabled after the release instead.
russellballestrini commented 2025-11-11 09:18:23 -05:00 (Migrated from git2.unturf.com)

MathJax and KaTeX are not drop-in replacements for each other. While both are libraries for rendering LaTeX math on the web, they have different capabilities and integration requirements. KaTeX is much faster but supports fewer LaTeX commands and features compared to MathJax. For example, KaTeX has limitations with Unicode characters and some LaTeX environments that MathJax supports. Switching from MathJax to KaTeX usually requires additional JavaScript adjustments, such as stripping certain delimiters that KaTeX does not accept directly. MathJax, especially in its version 3+, is a complete rewrite with changes in configuration and loading, making it not directly compatible with MathJax v2 settings.

> MathJax and KaTeX are not drop-in replacements for each other. While both are libraries for rendering LaTeX math on the web, they have different capabilities and integration requirements. KaTeX is much faster but supports fewer LaTeX commands and features compared to MathJax. For example, KaTeX has limitations with Unicode characters and some LaTeX environments that MathJax supports. Switching from MathJax to KaTeX usually requires additional JavaScript adjustments, such as stripping certain delimiters that KaTeX does not accept directly. MathJax, especially in its version 3+, is a complete rewrite with changes in configuration and loading, making it not directly compatible with MathJax v2 settings.
russellballestrini commented 2025-11-11 09:18:48 -05:00 (Migrated from git2.unturf.com)

maybe we need to support both? thoughts?

maybe we need to support both? thoughts?
Groupr commented 2025-11-11 09:21:08 -05:00 (Migrated from git2.unturf.com)

i was thinking of backward compatibility but then i remembered it was worth swapping, katex seems to be better but yea thats a good idea to just have both .

i was thinking of backward compatibility but then i remembered it was worth swapping, katex seems to be better but yea thats a good idea to just have both .
russellballestrini commented 2025-11-24 10:44:16 -05:00 (Migrated from git2.unturf.com)

@Groupr there is no alter_column support on sqlite3 you need to do a column add.

@Groupr there is no alter_column support on sqlite3 you need to do a column add.
Groupr commented 2025-11-27 11:10:32 -05:00 (Migrated from git2.unturf.com)

changed this line in version 2 of the diff

changed this line in [version 2 of the diff](/engineering/remarkbox/remarkbox/-/merge_requests/25/diffs?diff_id=820&start_sha=f408487224e50f9a46138a745c69005405a87f24#bd1da1a9827c8f80b2c666debd836c2c82e816bf_20_20)
Groupr commented 2025-11-27 11:10:33 -05:00 (Migrated from git2.unturf.com)

added 1 commit

  • 9989caf9 - Update 7ad8508e50de_rename_mathjax_to_katex.py

Compare with previous version

added 1 commit <ul><li>9989caf9 - Update 7ad8508e50de_rename_mathjax_to_katex.py</li></ul> [Compare with previous version](/engineering/remarkbox/remarkbox/-/merge_requests/25/diffs?diff_id=820&start_sha=f408487224e50f9a46138a745c69005405a87f24)
Groupr commented 2025-11-27 11:14:04 -05:00 (Migrated from git2.unturf.com)

added 1 commit

Compare with previous version

added 1 commit <ul><li>a7e39520 - Update file notify.py</li></ul> [Compare with previous version](/engineering/remarkbox/remarkbox/-/merge_requests/25/diffs?diff_id=822&start_sha=9989caf95f7cc973e7521f9121c9a1d7f8a7b023)
Groupr commented 2025-11-27 11:16:14 -05:00 (Migrated from git2.unturf.com)

ok noted

ok noted
Groupr commented 2025-11-27 11:16:15 -05:00 (Migrated from git2.unturf.com)

updated to log username= instead of email=

updated to log username= instead of email=
Groupr commented 2025-11-27 11:28:52 -05:00 (Migrated from git2.unturf.com)

added 1 commit

  • 30a62b87 - Update 7ad8508e50de_rename_mathjax_to_katex.py

Compare with previous version

added 1 commit <ul><li>30a62b87 - Update 7ad8508e50de_rename_mathjax_to_katex.py</li></ul> [Compare with previous version](/engineering/remarkbox/remarkbox/-/merge_requests/25/diffs?diff_id=824&start_sha=a7e39520a7d490adc3ed07e1ec27f64dbcd465b1)
Groupr commented 2025-11-27 18:21:01 -05:00 (Migrated from git2.unturf.com)

added 1 commit

  • 1ef1c8d6 - Update 7ad8508e50de_rename_mathjax_to_katex.py

Compare with previous version

added 1 commit <ul><li>1ef1c8d6 - Update 7ad8508e50de_rename_mathjax_to_katex.py</li></ul> [Compare with previous version](/engineering/remarkbox/remarkbox/-/merge_requests/25/diffs?diff_id=826&start_sha=30a62b872180f8997b7791d8f7d35031e6b4ebc2)
This pull request has changes conflicting with the target branch.
  • remarkbox/lib/notify.py
  • remarkbox/lib/render.py
  • remarkbox/static/js/custom.js
  • remarkbox/templates/snippets/create.j2
  • remarkbox/templates/snippets/forms.j2
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin Katex_Swap:Katex_Swap
git checkout Katex_Swap

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git checkout main
git merge --no-ff Katex_Swap
git checkout Katex_Swap
git rebase main
git checkout main
git merge --ff-only Katex_Swap
git checkout Katex_Swap
git rebase main
git checkout main
git merge --no-ff Katex_Swap
git checkout main
git merge --squash Katex_Swap
git checkout main
git merge --ff-only Katex_Swap
git checkout main
git merge Katex_Swap
git push origin main
Sign in to join this conversation.
No reviewers
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: engineering/remarkbox#31
No description provided.