MediaWiki has one of the worst syntaxes and formalisations out there.
I've been trying to render wikipedia pages on and off for more than 10 years and there is no independent parser covering the whole syntax and magic behaviour.
https://www.mediawiki.org/wiki/Alternative_parsers
There is only parsoid, developed for the visual editor and that took pretty much a decade to build with much pain and suffering.
This is not the answer.