Add annotations and markup changes needed for VisualEditor
Some of these came from https://www.mediawiki.org/wiki/Extension:VisualEditor/Skin_requirements and some came from looking at how Vector works with the visual editor.
There was only one nasty structural change that wasn't completely great html, but was the smallest change needed to enable VisualEditor.
@justin I'm going to merge this now, but marking you as a reviewer so you can come in and take a look when you have time. I just want to release this as it works. If you think we should go a different way, we can definitely do that and release a new version easily enough!