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

Include span for Events, not just BrokenLinks #486

Closed
jyn514 opened this issue Sep 27, 2020 · 2 comments
Closed

Include span for Events, not just BrokenLinks #486

jyn514 opened this issue Sep 27, 2020 · 2 comments

Comments

@jyn514
Copy link
Contributor

jyn514 commented Sep 27, 2020

Rustdoc currently has code that looks like this (yes, it's awful): https://github.com/rust-lang/rust/blob/6f2e1c65933702186cc681a3772862afa77dd632/src/librustdoc/html/markdown.rs#L1076-L1088

Originally I was hoping I could get rid of it now that BrokenLinks have spans. But the spans are only for the broken links, and rustdoc doesn't get them for [parenthesized](links). Is it possible to add that info to Event? I think that would allow removing it from BrokenLink too, but I'm not 100% sure about that.

As a side note, it looks like pulldown includes the [] in the span - is that intentional? Rustdoc only wants the URL itself, which isn't currently possible: consider [inline][link]. The - in the diff is rustdoc's hacky generated span, the + is pulldown's span.

 LL | /// docs [label][with#anchor#error]
-   |                  ^^^^^^^^^^^^^^^^^ contains invalid anchor
+   |          ^^^^^^^^^^^^^^^^^^^^^^^^^^ contains invalid anchor
@ehuss
Copy link
Contributor

ehuss commented Sep 27, 2020

I believe into_offset_iter gives the Range for each Event. Rustdoc uses that in a few places already.

@jyn514
Copy link
Contributor Author

jyn514 commented Sep 27, 2020

Oh look at that! Thanks, I just didn't read the docs carefully enough :)

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