added allow_latex context variable for rendering, fix undefined check for mathjax in js