-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Rustdoc does not compile code pieces if they are not separated from the surrounding text #28712
Comments
Does it render correctly? If not it may be a bug in the mardown parser. |
This is how at least some markdown parsers work - without a double line break before the tick marks, it's treated as part of the previous paragraph. |
The decision now then is whether we consider this working-as-expected or an actual bug? |
CommonMark says
http://spec.commonmark.org/0.22/#code-fence So I would argue it is a bug. |
Also affects lists.
|
With
|
Doctests were disabled globally because up until rust-lang#2456, they were just formatting examples which were not supposed to compile. Now that there is one runnable doctest, I disabled the other ones individually (by adding the ignore directive). I also added some empty lines around the code blocks to avoid the following warning and instead ignore the code blocks cleanly: WARNING: ... Code block is not currently run as a test, but will in future versions of rustdoc. Please ensure this code block is a runnable test, or use the `ignore` directive. See rust-lang/rust#28712 for further details.
The following is a perfectly valid Markdown, however, Rustdoc does not compile the piece of code (and, naturally, it is not run as a test with
cargo test
):This, however, does work:
(that is, it fails to compile due to unknown symbol
SomeUnknownStructure
).Note the empty line before the code block in the doc comment.
The text was updated successfully, but these errors were encountered: