-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
No way to not comment a line beginning with a # in rustdoc #41783
Comments
This behavior is actually intentional. rustdoc strips out lines that begin with |
Ok, but there doesn't seem to be a way to intentionally include lines beginning with a single hash, either with |
Okay, I've put up a fix with |
That's a great fix, thanks a lot. |
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.
I have a doctest in my
shell_parse
crate that includes a shell-style comment at the start of a line, inside a code block. Minimal example:This causes the hash to be stripped out in
cargo doc
output (which is annoying, because it's part of the example), and causes the parsing to fail and the doctest to fail as a result. Using the same code in a normal test does not fail, and replacing the#
with##
causes it to appear in documentation output and the test to succeed. This is the approach I've taken as a workaround, but it's not what I actually want.The text was updated successfully, but these errors were encountered: