-
Notifications
You must be signed in to change notification settings - Fork 13.3k
rustdoc: escape the deprecated and unstable reason text #38244
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
(rust_highfive has picked a reviewer for you, use r? to override) |
@bors r+ rollup |
📌 Commit 4cfc1e3 has been approved by |
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.
These strings are run through a Markdown renderer after this and it doesn't make any sense to HTML escape something and then treat it as Markdown. I think the right thing to do here is replace the Markdown rendering with just escaping.
Also there is one other instance of this below these two that should probably be changed as well.
✌️ @ollie27 can now approve this pull request |
Actually we could leave it using Markdown and just add |
@ollie27 I'm thinking that even if using Markdown syntax to mark code would be preferable here it should still look reasonable (as in escaped) even if the code author forgets to do so. HTML Escaping the text of the unstable reasons and then passing Markdown syntax will only avoid people from using HTML anchors for links or HTML tags for formatting, little more. I don't think any part of the markdown syntax would be affected by the escaping in the first place :) |
4cfc1e3
to
19cfcb8
Compare
Adding the quotes and escaping results in it being rendered as "will be deprecated if and when |
@ollie27 you're absolutely right. |
/cc @rust-lang/tools , how do we want to move forward here? |
Sounds like @ollie27's suggestion may be the least invasive? |
19cfcb8
to
c1a404d
Compare
`MarkdownHtml` structs escape HTML tags from its text.
c1a404d
to
778b3cb
Compare
@ollie27 I feel that the patch is ready for merging. It changes this specific instance of the issue to use the code formatting, and avoids the issue going forward whenever somebody actually forgets to do so by escaping correctly by relying on Hoedown's feature flags. Only drawback is that you can't use HTML tags in these messages, but I feel that no one would be missing that feature for this field. |
I'm not sure about having the Markdown rendering act differently here to other places but as you've said it probably won't cause any problems in reality. We'll have to see what other people think. Either way, if this change is accepted it will need tests. |
20a8320
to
129a385
Compare
129a385
to
96c52d4
Compare
☔ The latest upstream changes (presumably #38329) made this pull request unmergeable. Please resolve the merge conflicts. |
ping @ollie27 are you happy with this now? |
Yeah this is fine with me. Are people okay with no longer allowing raw HTML in depreciation and stability messages? |
@ollie27 sgtm |
Sure. @bors r+ |
📌 Commit e766c46 has been approved by |
rustdoc: escape the deprecated and unstable reason text Fix #38220. Instead of the [current output](https://doc.rust-lang.org/std/boxed/trait.FnBox.html): <img width="967" alt="incorrect unescaped unstable reason in docs" src="https://cloud.githubusercontent.com/assets/1606434/21021898/73121d42-bd2f-11e6-8076-8a5127dbc010.png"> display: <img width="979" alt="escaped unstable reason in docs" src="https://cloud.githubusercontent.com/assets/1606434/21021876/52eb0f88-bd2f-11e6-9088-58bdc7d92328.png">
☀️ Test successful - status-appveyor, status-travis |
Fix #38220.
Instead of the current output:
display: