-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No MathJax in embedded threads #21
Comments
thanks for creating the issue! Im a bit busy the coming 3 weeks, but when I find some time I will look at it. |
@selfshadow You could also ask at https://meta.discourse.org/t/mathjax-plugin-supports-math-notation-using-latex/12826 if someone has find a workaround. Btw, does the plugin works for you in your own forum, I don't use the plugin myself anymore, but some people have reported it to be broken. |
I'll try that, but I'm doubtful that there is a trivial workaround (not requiring a modification to the plugin or Discourse) if it's down to iframe security, since this is what also prevented MathJax from working with Disqus in recent years.
It seems to be working for me (1.4.0.beta3 currently). |
We encountered this same issue: MathJax.js isn't being included in the embedded iframe. I can't find an obvious way for a Discourse plugin to inject scripts into the embedded thread template. Our workaround was to patch a script tag into the body of the embed.html erb template. Here's two additions to the hooks:
after_code:
- exec:
cd: $home/plugins
cmd:
- git clone https://github.com/discourse/docker_manager.git
- git clone https://github.com/kasperpeulen/discourse-mathjax.git
- file:
path: /var/tmp/mathjax_embed.patch
contents: |
diff --git a/app/views/layouts/embed.html.erb b/app/views/layouts/embed.html.erb
index b4ee7cf..c91743c 100644
--- a/app/views/layouts/embed.html.erb
+++ b/app/views/layouts/embed.html.erb
@@ -70,5 +70,6 @@
</head>
<body>
<%= yield %>
+ <script src="//cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
</body>
</html>
- exec:
cd: $home
cmd:
- patch -p1 < /var/tmp/mathjax_embed.patch |
Thank you so much for the fix, @brotchie. I finally got around to trying this out just now and it worked like a charm! |
@brotchie: It seems that the patch is no longer working for me, possibly after updating Discourse. I thought this might have simply been due to MathJax discontinuing their CDN, but I updated the URL and it's still not working. Any ideas? I verified that |
Okay, I figured it out. I had been testing the discourse-math plugin and in the process edited some comments to get them to work. I hadn't noticed that, under the hood, it had wrapped math statements with Here's the complete updated patch:
|
MathJax is currently not working when forum threads are embedded (http://eviltrout.com/2014/01/22/embedding-discourse.html) in a blog post. I'm guessing that this is due to Discourse being wrapped in an iframe, and that I need to include MathJax in the iframe contents in that case.
I'd be happy investigate this issue myself, but I may need one or two pointers.
The text was updated successfully, but these errors were encountered: