Ensure toc attribute is available on Markdown class.

This appears to have recently been broken with the fixes in #191.
This time I've added tests to prevent future breakage and added
documentation to explain the behavior.