Skip to content
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

Turbolinks Compatability #13

Open
samozeleznik opened this issue Feb 24, 2015 · 2 comments
Open

Turbolinks Compatability #13

samozeleznik opened this issue Feb 24, 2015 · 2 comments

Comments

@samozeleznik
Copy link

This gem does not work with turbolinks by default. Is there a solution for that?

@zerocool4u2
Copy link

zerocool4u2 commented Sep 11, 2016

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: [[ '$', '$']]

@mag2007
Copy link

mag2007 commented Jul 15, 2019

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants