Skip to content

Replace escape-latex package with inline ESM implementation#3651

Open
andreialecu wants to merge 1 commit intojosdejong:developfrom
andreialecu:replace-escape-latex-with-esm
Open

Replace escape-latex package with inline ESM implementation#3651
andreialecu wants to merge 1 commit intojosdejong:developfrom
andreialecu:replace-escape-latex-with-esm

Conversation

@andreialecu
Copy link
Copy Markdown

Summary

  • Replaces the CommonJS-only escape-latex dependency with an inline ESM module
  • Eliminates the "Module 'escape-latex' is not ESM" warning in Angular and other ESM-first bundlers
  • Enables proper tree-shaking of this code

Part of #3649

Details

The escape-latex package hasn't been updated in 7+ years and only ships CommonJS. Rather than waiting for an upstream ESM build, this inlines a minimal implementation that only includes what mathjs needs.

The implementation produces identical output to the original escape-latex package v1.2.0.

Test plan

  • New unit tests for the escapeLatex module (all special characters, formatting escapes, edge cases, stack overflow regression)
  • Existing latex.test.js tests pass
  • All 6666 unit tests pass
  • Lint passes with zero warnings

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.

1 participant