orsharir / github-mathjax

Chrome extension for rendering LaTeX equations in GitHub with MathJax
Other
153 stars 49 forks source link

New comments don't show math without refresh, as well as preview mode #1

Closed orsharir closed 7 years ago

orsharir commented 8 years ago

At the moment there's a bug that after adding a new comment to an issue or editing an old comment, the math in the comment is displayed as plain text. Should watch respective events and update math display.

Similarly, should add support for preview mode of the editor.

Mottie commented 7 years ago

You can add this code to update the page when the preview tab is hovered, or active:

// "preview:render" only fires when using the hotkey
// "preview:setup" fires on hover & click of comment preview tab
document.addEventListener("preview:setup", function() {
  setTimeout(function() {
    // must include some rendering time...
    // 200 ms seems to be enough for a 1100+ line markdown file
    MathJax.Hub.Queue(["Typeset",MathJax.Hub]);
  }, 500);
});
orsharir commented 7 years ago

Fixed in d649cd914c045d80c509f887c3d4d837a89b52e5