See discussion in https://gerrit.wikimedia.org/r/c/mediawiki/extensions/Math/+/710329/23/ServiceWiring.php#53
This is too difficult for now. It requires a math rendering service.