Use the public Parsoid API.

See http://lists.wikimedia.org/pipermail/wikitext-l/2013-November/000819.html

One current bug: the image API returns unparsed <meta> nodes for missing
images, which means that our local icons on the home page are gone.

When https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Error_handling
is implemented (https://bugzilla.wikimedia.org/show_bug.cgi?id=48900)
we will be able to postprocess the missing images and fix up the links.