Perhaps fences ````
and ~~~~
should differ slightly from each other: one is always displayed verbatim (plus syntax highlighting etc.), while the other should be parser into something more useful if safe and possible. Users would specify the language as the first part the info string as is common practice for source code.
~~~~ tex
x^2
~~~~
.
<figure class="formula">
<var>x</var><sup>2</sup>
</figure>
```` tex
x^2
````
.
<pre><code class="language-tex">x^2</code></pre>
This does not prevent extensions from defining more specific custom fences or line prefixes for display math.