Add a mode to docgen to run the code samples in the documentation.

This alleviates copying them elsewhere to ensure they are not broken.