mathjax-rails
mathjax-rails copied to clipboard
Turbolinks Compatability
This gem does not work with turbolinks by default. Is there a solution for that?
now with turbolinks 5 works perfect, the only detail is if you wanna use a config file(not an embed script on the view) you will need to load it after the mathjax_tag
method or, a more simple way, do something like this:
$(document).on 'turbolinks:load', ->
MathJax.Hub.Queue(["Typeset", MathJax.Hub])
MathJax.Hub.Config
showMathMenu: false
tex2jax:
inlineMath: [[ '$', '$']]
I am facing same problem, but it is more complicated. I have a dynamical content on site, which is loaded after mathjax does his job. And i am running turbolinks 5.2.0. Before updating my turbolinks gem i was using two script files
mathjax config
window.MathJax = {
extensions: ["Safe.js"],
tex2jax: {
inlineMath: [ ['$$','$$'], ['$','$'], ['\\(','\\)'] ],
processEscapes: true
}
mathjax load config needed for dynamic content (called at the end of page)
if (window.MathJax) {
MathJax.Hub.Queue(
["Typeset",MathJax.Hub]
);
}
Now when i switch between pages using "back and forward" my mathjax is rendered twice or even more, depending on how ofter i go back and forward. I am sure it is because turbolinks calls mathjax multiple times, but i cant figure out why.