Skip to content

repl: Add LaTeX mimetype support#44525

Draft
auriium2 wants to merge 7 commits intozed-industries:mainfrom
auriium2:latex-support
Draft

repl: Add LaTeX mimetype support#44525
auriium2 wants to merge 7 commits intozed-industries:mainfrom
auriium2:latex-support

Conversation

@auriium2
Copy link
Contributor

Adds latex mimetype support to the repl. Also contains my svg support pr

image image

It does this by taking latex mimetype outputs and converting the raw latex to typst using mitex, then using the typst and typst svg crates to render that typst as a svg. Then that svg is rendered in the same way that other svgs are rendered. This method is crude but could ostensibly also be used to add support for latex rendering to markdown and other places in zed where latex is needed

In order to avoid bringing in the typst-kit crate which does a bunch of weird networking things and would probably break dependencies, I chose to statically embed all of the .typ files that mitex requires into the binary and then feed them to typst by creating a minimal typst world

Addresses #9778's latex mimetype support check box and ideally #10899

Release Notes:

  • Added latex mimetype support to the repl

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Dec 10, 2025
@auriium2 auriium2 marked this pull request as draft December 10, 2025 10:26
@auriium2
Copy link
Contributor Author

impossible to pass check_style thanks to the spell check targeting the .typ files

@auriium2
Copy link
Contributor Author

tests should pass now, was failing because of rkyv blanket impls; rkyv was brought in by typst. Even tho tests may be passing now, it's worth discussion on if it is ok to bring in typst + mitex and their large dependency chains. do not know zed precedence for bringing in dependencies with pr, would like to know. Could be worth it for latex support?

@maxdeviant maxdeviant changed the title repl: Add latex mimetype support repl: Add LaTeX mimetype support Dec 10, 2025
@auriium2
Copy link
Contributor Author

@rgbkrk would want you to weigh in on my approach here before i continue this path haha

@rgbkrk
Copy link
Collaborator

rgbkrk commented Jan 7, 2026

Since I've been a bit more away from Zed, I haven't been sure about how much the Zed folks want to add in more dependencies like this but it would make sense for scientific users. @mikayla-maki this adds in a new crate that would let use render LaTeX in the repl (and elsewhere if that were practical, like in Markdown).

@rgbkrk rgbkrk added the area:repl repl, jupyter, notebooks, etc label Jan 7, 2026
@rgbkrk
Copy link
Collaborator

rgbkrk commented Jan 12, 2026

In a chat, @MrSubidubi noted that someone figured out how to make ReX use GPUI for rendering. I'd be interested in what you think: https://github.com/lnay/latex-gpui-experiment. Based on KenyC/ReX#23 we might be able to make the base ReX crate adapt well to GPUI.

@auriium2
Copy link
Contributor Author

@rgbkrk This seems promising, i can try to draft a prototype with ReX as long as ReX is feasible to include in zed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:repl repl, jupyter, notebooks, etc cla-signed The user has signed the Contributor License Agreement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants