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

Allow configuration of html5ever::driver::ParseOpts #12

Closed
ticky opened this issue Aug 12, 2018 · 2 comments
Closed

Allow configuration of html5ever::driver::ParseOpts #12

ticky opened this issue Aug 12, 2018 · 2 comments

Comments

@ticky
Copy link

ticky commented Aug 12, 2018

Currently, it doesn’t appear to be possible to configure how html5ever’s parser is configured.

This is mostly okay but if you want to override scripting_enabled or other such settings you can’t right now!

@causal-agent
Copy link
Owner

I'm not sure if Html::parse_document and parse_fragment should take ParseOpts. How many calls would pass something other than Default::default()? Without it, I think you could call the html5ever parser directly:

let parser = html5ever::driver::parse_document(scraper::Html::new_document(), parse_opts);
let doc = parser.one(html_string);

@ticky
Copy link
Author

ticky commented Aug 30, 2018

Confirmed that this does definitely work! 😄

I didn’t even consider that you could work “backwards” like that by giving html5ever a scraper document as the sink. Maybe a better approach than allowing this from scraper methods then would be to note this as an option?

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