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

docs: add hast-util-to-babel-ast #21

Conversation

stefanprobst
Copy link

this adds hast-util-to-babel-ast by the svgr project to the hast utils list.

they also use svg-parser to parse svgs to hast, but i wasn't sure where this should be added (or how it compares to rehype-parse with scope: 'svg')

@wooorm
Copy link
Member

wooorm commented Sep 29, 2020

Hmm, unfortunately I believe SVGRs internal hast format doesn’t comply with hast.
Have you tried this out?

@stefanprobst
Copy link
Author

i have, but only for simple stuff. i'll investigate! svg-parser does explicitly state that they parse to unified hast: https://github.com/Rich-Harris/svg-parser#svg-parser

@wooorm
Copy link
Member

wooorm commented Sep 29, 2020

They indeed do say that, but it is incorrect. I let them know here.

It’s a cool idea, but it’s made for them and to be used internally. It won’t work with other hast utilities. So I’d rather not include it here!

@wooorm wooorm closed this Sep 29, 2020
@stefanprobst
Copy link
Author

ok cool. personally i haven't used svg-parser, but only hast-util-to-babel-ast together with rehype-parse in svg space. do you have any pointers as to what is missing wrt to full hast compatibility in hast-util-to-babel-ast?

@stefanprobst stefanprobst deleted the docs/add-hast-util-to-babel-ast branch September 29, 2020 15:04
@wooorm
Copy link
Member

wooorm commented Oct 1, 2020

hast is more than settings keys/values from an XML parser on an object. Notably, the way properties and their values are handled (Element). This whole mapping is and these changes are done by hast already. I believe having them in there interfere with hast!

@stefanprobst
Copy link
Author

thanks, that's super helpful!

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

Successfully merging this pull request may close these issues.

None yet

2 participants