BeniCherniavsky has written some preprocessing scripts for making inline TeX (for LaTeX and other [ HTML etc.] output) math much easier; instructions here...
BeniCherniavsky has written some preprocessing scripts for converting the texmath role/directive into images for HTML output and raw directives/subsitution for LaTeX output...
BeniCherniavsky has written a generic preprocessing module for roles and/or directives and built preprocessors for TeX math for both LaTeX and HTML output on top of it...