Skip to content

Instantly share code, notes, and snippets.

@pkra
Last active December 11, 2015 02:48
Show Gist options
  • Save pkra/4532776 to your computer and use it in GitHub Desktop.
Save pkra/4532776 to your computer and use it in GitHub Desktop.
A MathJax bookmarklet for experimentation. It replaces images with their title -- hoping it's LaTeX source -- and calls MathJax to render the TeX. Note: replaces all images! Based on https://github.com/dzejkej/mathjax-bookmarklet and http://docs.mathjax.org/en/latest/dynamic.html Seems to works on wordpress.com // jetpack-LaTeX-images
javascript:(function(){var images = document.getElementsByTagName('img'), count = 0; for (var i = images.length - 1; i >= 0; i--) { var img = images[i]; var script = document.createElement("script"); script.type = "math/tex"; if (window.opera) {script.innerHTML = img.title} else {script.text = img.title} img.parentNode.replaceChild(script,img);count++; };function a(a){var b=a.createElement('script'),c;b.src='https://c328740.ssl.cf1.rackcdn.com/mathjax/2.1-latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML.js',b.type='text/javascript',c='MathJax.Hub.Config({tex2jax:{inlineMath:[[\'$\',\'$\']],displayMath:[[\'\\\\[\',\'\\\\]\']],processEscapes:true}});MathJax.Hub.Startup.onload();',window.opera?b.innerHTML=c:b.text=c,a.getElementsByTagName('head')[0].appendChild(b)}function b(b){b.MathJax===undefined?a(b.document):b.MathJax.Hub.Queue(new b.Array('Typeset',b.MathJax.Hub))}var c=document.getElementsByTagName('iframe'),d,e;b(window);for(d=0;d<c.length;d++)e=c[d].contentWindow||c[d].contentDocument,e.document||(e=e.parentNode),b(e)})()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment