Fix handling of subscripts and superscripts (including footnotes).

Add formatting for subscripts and superscripts, which has the added bonus of making footnotes work.

Without subscripts and superscripts:
![codeexample_nosubscript](https://f.cloud.github.com/assets/1570381/670053/da5a81a2-d83a-11e2-9102-ea4d167d4928.png)

With subscripts and superscripts:
![codeexample_subscript](https://f.cloud.github.com/assets/1570381/670055/e15ffbf8-d83a-11e2-8821-134b7e8e41bd.png)