Oh, I wouldn't Markdown that represents real documents to produce anything useful, so I just automatically skipped that possibility.
If you've got a real document that produces a non-trivial graph when you render its headers this way, you've probably got yourself a really, really poorly written document. Written text needs to have been serialized somehow, and as a side effect, you'll make the graphviz view of the document pathologically uninteresting. Conventional outline views are much better suited for written text.
I also have md on Github that I might want to use.