-
Notifications
You must be signed in to change notification settings - Fork 29
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
Parse misuse resistance #191
base: main
Are you sure you want to change the base?
Conversation
…municate to later stages The following code can easily be mistaken for using the context to store information retrieved by render_to_lines. This is actually not the case. let mut context = self.make_context(); self.do_parse(&mut context, input) .render_with_context(&mut context, 100, self.decorator);
2c3a1c2
to
de29b06
Compare
Hi, |
Note that it does not hold that HtmlContext::default() == config::plain().make_context() but the relevant fields used by fn parse_with_context() are the same. This is a bit unclear, so this change makes this more transparent.
a78b581
to
0ec601f
Compare
If #192 gets accepted, we'll rebase on main. What remains is the last commit, which originally suggested to replace On second thought, we're not so sure anymore we'll want to configure |
…method on Config The parse function is an odd one in the current API, other functions can be separated cleanly into functions that are convenient and functions that need to be configured. The parse function does not advertise what configuration it uses, and will silently drop css information, as it parses with config::plain() as default configuration. This can lead to the following misuse of the public API let render_tree = parse(html)?; customcfg.render_to_string(render_tree, 80)?;
1b9fc9c
to
fbaf8b3
Compare
The parse function is potentially easy to misuse.
Also, some unrelated refactors.