Mathjax does not render inside HTML tags

I am trying to write mathematical proofs in Obsidian. At the end of my proofs, I am trying to have a black square on the right.

I have this HTML code to do so:

<div class="right-align"> <span class="math display">\blacksquare</span> </div>

I have a CSS snippet that lets me right-align like so, but the math does not render in editing mode. When I am in read mode, though, the black square renders. Is there a fix or a plugin to make it render during editing?