Skip to content

Render TeX math as images in the preview - #7

Open
MikiFER wants to merge 1 commit into
flashmodel:masterfrom
MikiFER:render-math
Open

MikiFER wants to merge 1 commit into
flashmodel:masterfrom
MikiFER:render-math

Conversation

@MikiFER

@MikiFER MikiFER commented Oct 27, 2026

Copy link
Copy Markdown

Summary

  • Render inline $...$ and display $$...$$ TeX, including AMS aligned and \underbrace, as theme-colored PNG images in the preview.
  • Typesetting uses a local Node install of mathjax and @resvg/resvg-js. Missing tools leave the formula as source and show one status message per session.
  • Keep math images inside table cells. minihtml does not paint images in white-space: pre, so table alignment now uses non-breaking spaces.

Test plan

  • Install mathjax and @resvg/resvg-js, set math_node and math_modules if Node is not on Sublime's PATH, then reopen the preview.
  • Confirm a $$...$$ formula and an inline $...$ formula render as images, and that a bad formula stays as fenced source.
  • Confirm formulas in table cells render as images while the other columns stay aligned.
  • Confirm `$x$`, fenced code, and \$100 stay literal.
  • With the Node packages missing, confirm the preview still opens and shows the formula source.

Made with Cursor

Co-authored-by: Cursor <cursoragent@cursor.com>
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