Hi
Noticed you mentioned MathJax, not sure if it's relevant but Kineo seem to have looked at this:
https://github.com/cgkineo/adapt-mathJax