Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Would to_mdast() return variants of mdast::Node other than mdast::Node::Root? #109

Open
lo48576 opened this issue Mar 3, 2024 · 1 comment

Comments

@lo48576
Copy link

lo48576 commented Mar 3, 2024

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.

@wooorm
Copy link
Owner

wooorm commented Mar 3, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants