Thanks for this patch; I think it'll be a great boon.
Patch looks good, but I didn't see a test. Do we have anything that can check that the docs are making their way in. I'm particularly curious to see how newlines and whitespace is being translated. That stuff is easy to get off by one, so would be worth testing.