Currently when an extension is modified in VE, we generate XML in the client and ask Parsoid to convert it to HTML so we can get an updated version of the view.
However this means we are generating wikitext in the client:
wikitext = mw.html.element( tagName, attrs, new mw.html.Raw( extsrc ) );
which really shouldn't be our job. We should instead have an API to which we pass model HTML, and get back model HTML hydrated with view HTML:
in:
<div typeof="mw:Extension/Math" data-mw="...{body:'x+y'}..."></div>
out:
<div typeof="mw:Extension/Math" data-mw="...{body:'x+y'}..."><img src="..../x%20y.png"></div>
This is going a blocker to using HTML attributes in Parsoid.