Extract mathjax logic to easy-mathjax library.