Skip to content

Instantly share code, notes, and snippets.

@PM2Ring
Last active December 20, 2025 19:35
Show Gist options
  • Select an option

  • Save PM2Ring/af2eb511fde7de4d3f440bc672ed0d57 to your computer and use it in GitHub Desktop.

Select an option

Save PM2Ring/af2eb511fde7de4d3f440bc672ed0d57 to your computer and use it in GitHub Desktop.
New ChatJax bookmarklet

Here's my new version of the "Start Chatjax" bookmarklet.

javascript:(()=>{if(window.MathJax===undefined){const%20script=document.createElement("script");script.src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS_HTML";script.text='MathJax.Hub.Config({extensions:["tex2jax.js"],tex2jax:{inlineMath:[["$","$"],["\\\\\\\\\\\\(","\\\\\\\\\\\\)"]],displayMath:[["$$","$$"],["\\\\[","\\\\]"]],processEscapes:true},jax:["input/TeX","output/HTML-CSS"]});MathJax.Hub.Startup.onload();';document.head.append(script);(function%20doChatJax(){setTimeout(doChatJax,1000);MathJax.Hub.Queue(["Typeset",MathJax.Hub]);})();}else{MathJax.Hub.Queue(["Typeset",MathJax.Hub]);}})();

And here's the "Render Mathjax" bookmark. It's more efficient to use this version on static pages, like the Chat transcripts.

javascript:(()=>{if(window.MathJax===undefined){const%20script=document.createElement("script");script.src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS_HTML";script.text='MathJax.Hub.Config({extensions:["tex2jax.js"],tex2jax:{inlineMath:[["$","$"],["\\\\\\\\\\\\(","\\\\\\\\\\\\)"]],displayMath:[["$$","$$"],["\\\\[","\\\\]"]],processEscapes:true},jax:["input/TeX","output/HTML-CSS"]});MathJax.Hub.Startup.onload();';document.head.append(script);}else{MathJax.Hub.Queue(["Typeset",MathJax.Hub]);}})();

The original versions can be found on robjohn's site

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment