Mathjax in a modal


I was writing a plugin and tried to render some math expressions in an HTML element in a modal. The innerhtml is a string that may contain certain math expressions between $$. How do I ask mathjax that is already in obsidian to auto-search the math expressions and render them in the html? I was guessing that I needed to add a certain class to the element but couldn’t figure it out. Thanks.