I haven't read the parser thoroughly, but it looks like to_mdast() always returns mdast::Node::Root(_) on success, even if the source document looks like a simple "inline" text.
If so, isn't it natural and explicit to return mdast::Root directly instead of wrapping it to mdast::Node enum?
Or if it can return something other than mdast::Node::Root(_) variant, the condition would be worth documented.
I'm wondering my converter over md AST can assume that the returned AST is always mdast::Root.
Hey! It does indeed always return a root. I don’t have strong opinions on this. The AST can be improved though. That’s one of the main reasons this is still alpha. There are different issues about it.
I haven't read the parser thoroughly, but it looks like
to_mdast()
always returnsmdast::Node::Root(_)
on success, even if the source document looks like a simple "inline" text. If so, isn't it natural and explicit to returnmdast::Root
directly instead of wrapping it tomdast::Node
enum?Or if it can return something other than
mdast::Node::Root(_)
variant, the condition would be worth documented.I'm wondering my converter over md AST can assume that the returned AST is always
mdast::Root
.