I have some posts embedded within my website. The mathematics in them isn’t rendering within the embeds.
Using the old plugin, we could patch the embed.js.erb file to get the math to render. Is there something we can do with discourse-math to make it work in embeds?
Yes, and that works with the old third-party extension discourse-mathjax . However, discourse has implemented their own discourse-math extension and this solution does not work.
I don’t think the issue is with the plugin. The new plugin still uses the math spans (as you can see if you inspect the source of your page) so the solution should still work. What may have changes since then is how Discourse code embeds the posts?
The problem with that patch might be that it tries to load Javascript from mathjax.org, which I think the current Discourse version blocks by default? You might need to add https://cdn.mathjax.org to the cors origins Site Setting.
I wonder whether we could do something better here. @sam is there a way for a plugin to somehow modify app/views/layouts/embed.html.erb? So that the Discourse could load MathJax/KaTeX JS inside the embedded iframe?