Allow # to appear in rustdoc code output.#41785
Conversation
|
(rust_highfive has picked a reviewer for you, use r? to override) |
c62b4ea to
5ab531d
Compare
src/test/rustdoc/issue-41783.rs
Outdated
There was a problem hiding this comment.
If there's a better way to do this, I'd be happy to hear about it.
|
Ok, so it seems to be a good idea but I don't agree with how you implemented it or the idea of the feature. From my point of view, if a line starts with |
74b29b6 to
ba840c5
Compare
src/librustdoc/html/markdown.rs
Outdated
There was a problem hiding this comment.
This code won't work, switch the two conditions.
There was a problem hiding this comment.
Err, that was a mistake either way, it should be "# ".
ba840c5 to
45a22b1
Compare
src/librustdoc/html/markdown.rs
Outdated
There was a problem hiding this comment.
Something more intelligent in here could be to put this if condition after the next one, and replace starts_with("# ") with starts_with("#"). So you can write:
#extern crate foo;
As well as:
# extern crate foo;
45a22b1 to
2e072ac
Compare
"##" at the start of a trimmed rustdoc line is now cut to "#" and then shown. If the user wanted to show "##", they can type "###".
2e072ac to
ffe12b1
Compare
|
I wasn't able to make |
|
Well, it could be a future improvement. We'll see. For now it's good, thanks! @bors: r+ |
|
📌 Commit ffe12b1 has been approved by |
Allow # to appear in rustdoc code output. "##" at the start of a trimmed rustdoc line is now cut to "#" and then shown. If the user wanted to show "##", they can type "###". I'm somewhat concerned about the potential implications for users, since this does make a potentially backwards-incompatible change. Previously, `##` had no special handling, and now we do change it. However, I'm not really sure what we can do here to improve this, and I can't think of any cases where `##` would likely be correct in a code block, though of course I could be wrong. Fixes #41783.
|
☀️ Test successful - status-appveyor, status-travis |
"##" at the start of a trimmed rustdoc line is now cut to "#" and then
shown. If the user wanted to show "##", they can type "###".
I'm somewhat concerned about the potential implications for users, since this does make a potentially backwards-incompatible change. Previously,
##had no special handling, and now we do change it. However, I'm not really sure what we can do here to improve this, and I can't think of any cases where##would likely be correct in a code block, though of course I could be wrong.Fixes #41783.