Here’s a really weird edge case that shows why this part would be useful, especially for turning into an AST then back into markdown:
Say you turned this big of markdown into an AST:
_*Hello, world*_
You’d get this:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE CommonMark SYSTEM "CommonMark.dtd">
<document xmlns="http://commonmark.org/xml/1.0">
<paragraph>
<emph>
<emph>
<text>Hello, world</text>
</emph>
</emph>
</paragraph>
</document>
An ast->markdown converter might spit this out:
**Hello, world**
Resulting in bold rather than italic.