Experimenting with mediawiki-parser I found I needed the following changes to get anywhere with parsing: https://github.com/lrowe/pijnu/commit/d3f86c21f997771535f8f540b4237c0536fd58ff (Seems I can't have two pull requests open at once, and this is a different issue.)