-
Notifications
You must be signed in to change notification settings - Fork 13.3k
rustdoc: three tick code blocks confuse language choice with testing options #13947
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
Comments
Sundown (and by extension Rustdoc) supports multiple attributes, like
They actually get added as part of the |
At this point, I think that changing this behavior would need an RFC. It's effectively a feature request for Rustdoc, and would cause pretty huge churn amongst all the work that we're doing. I'm going to close this, but @pnkfelix , if you stil lcare about this and would like me to move it to the RFCs repo, just let me know. |
…, r=Veykril Add basic tooltips to adjustment hints  I'm not sure how to make them look nicer, but it's at least something.
changelog: [`slow_vector_initialization`]: auto-fix when appropriate I made a change for `slow_vector_initialization` lint suggestion to use `vec!` with size and remove the unneeded `resize` (or similar one) call in rust-lang#13912, while only the former one was suggested in the previous implementation. Now, I think this lint can be automatically fixed with no unnecessary code in some cases. I wrote “in some cases” because if there are comments between vector declaration and `resize`, Clippy shouldn't apply auto-fix because the comment may informational.
In other non-Rust contexts, when writing a code block, I have become used to using the (optional) first word after the initial three ticks to indicate the language of the code block. See for example the syntax example taken from octopress:
However,
rustdoc
has a different interpretation for the (again optional) first word after the initial three ticks: it is used for an directive regarding how to handle the given code when interpreted as a test. Potential values for the directive include:"ignore"
,"should_fail"
,"no_run"
It would be better if we came up with some way to indicate these meta-data directives in a manner that was still compatible with using the language directives as indicated in the octopress system.
At the very least, we could treat any code block that has a string that is not one of the builtin rustdoc directives (like the three listed above) nor the string
"rust"
should be implicitly treated asignore
. Then the author will retain the option of including the language name, and it will just get skipped by rustdoc when testing rust code blocks.(Other options include: find some other channel to use to communicate this information besides the initial three ticks. A simple one would be instead following the final three ticks, though admittedly that may be too subtle.)
The text was updated successfully, but these errors were encountered: