-
Notifications
You must be signed in to change notification settings - Fork 269
Provide ability to provide a callback to be used in case of broken link references #123
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
Conversation
|
r? @raphlinus |
raphlinus
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks good, just a couple of points. Thanks for doing the work!
| containers: Vec<Container>, | ||
| last_line_was_empty: bool, | ||
|
|
||
| /// In case we have a broken link/image reference, we can call this callback |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer the naming "link resolver"
| /// the provided callback will be called with the reference name, | ||
| /// and the returned pair will be used as the link name and title if not | ||
| /// None. | ||
| pub fn new_with_broken_link_callback(text: &'a str, mut opts: Options, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm curious whether the callback might be a reference rather than a Box, as it's only used for the lifetime of the parser (similar to text).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It could, I didn't want to introduce another lifetime param. But reusing the same one may work.
|
ping @raphlinus |
|
Sorry, I was waiting for my initial review to be addressed, and kinda dropped the ball. Do you think this is ready for merge? |
|
I think so |
|
Another thing we need is to make the HTML escaping stuff public, but I'll open a separate PR for that. |
|
Ok, I'll merge as is then. Thanks! |
|
@raphlinus can we get a version bump for this? rust-lang/rust#48274 recently landed so I'd like to incorporate this into rustc |
|
@Manishearth Done. I can do another release when the other stuff has landed. |
|
Sounds good. I'll have to wait for that since the feature as is can't be used. Might want to actually do it in a single version bump (or yank)? The other PR is technically a breaking change, but only if there's a version between these two PRs. |
fixes #121