Braces in latex get escaped

I’m using a simple template with KaTeX and the following fails:
$$\mathcal I := { X\subset E : \text{the vectors in $X$ are linearly independent} }.$$

I suspect this is due to Hugo automatically replacing { → {, and I check this by testing $a_{b}$.

How can I go around this, so that my LaTeX code also works on other markdown parsers that do not do this replacement?