aiconfig
aiconfig copied to clipboard
Support LateX rendering for outputs
From a discord user request -- https://discord.com/channels/1089284610329952357/1090134407588884513/1214807249437065246
It would be neat to update the rendering for outputs to support LateX / math rendering. Ideally we can implement it in the aiconfig editor and propagate the solution to the website.
I time-boxed looking into this and was not able to get it working with a nice solution. I first looked at the ideal solution (as proposed by react-markdown itself): https://github.com/remarkjs/react-markdown?tab=readme-ov-file#use-remark-and-rehype-plugins-math
But, latest version of rehype-katex
is not a compatible plugin for the rehypePlugins
prop of our current markdown component, and updating our react-markdown package surfaced a lot of errors in the implementation (i.e. we would need to upgrade and refactor/fix before trying rehype-katex plugin). Installing an earlier version of rehype-katex
surfaced some other module error (@ungap/structured-clone
) which prevented the app from building at all.
There are some other solutions I saw online, like using react-mathjax but it would also require a significant refactor to our markdown component and seems heavy-weight to wrap our markdown plugin with mathjax context.