I have some ideas about how to fix the whole thing... I will try to document them in an issue. However, it could take a time to define the test harness so not sure if we should block this PR until them. On the meanwhile, I'm afraid we need to manually examine the wiki XML/JSON fragments to spot potential needed changes.