Create renderInlineMath() to handle edge cases

Splits up math and markdown rendering into 2 functions:

renderMathAndMarkdown handles blockmath, and renderInlineMath handles inline math. Multiline math like matrices is not supported with inline math, but this is ok because it wouldn't look right anyway.