For quite sometime we are trying to figure out what's the best way to document code which calculate complicated mathematics.
Trying to explain the formula with words is hard, external documentation is easy to read but hard to keep updated (and is out of context).
Having butbucket source viewer will allow me to read inline code comments in a format way would be the best solution.
I've wrote a chrome extension which does this (using MathJax) and it's a bit hacky.
It should be fairly easy to add support for that from your side.
This is my extension: https://chrome.google.com/webstore/detail/latex-comments/pnbacpdpbhmkgfdjnibjdjmiahnoennj\\
This is it's code: https://bitbucket.org/efink/latex-comments-extension/overview