-
Notifications
You must be signed in to change notification settings - Fork 628
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
Code in documentation that's conditionally started with or
ignore based on feature doesn't render correctly
#10331
Comments
A workaround is to replace conditional docs with conditional code within the test. E.g. //! Since 2.0.0, the minimum supported Rust version is 1.56.
//!
//!```
//! # #[macro_use]
//! # extern crate downcast_rs;
//! # #![cfg(feature = "sync")]
//! // <Code to ignore when "sync" is enabled.>
|
I'm not sure what exactly the issue here is. Our aim is to render the readme files roughly like they would be on GitHub and https://github.com/marcianx/downcast-rs/blob/v2.0.0/README.md looks somewhat similar to https://crates.io/crates/downcast_rs/2.0.0 to me 🤔 |
https://docs.rs/crate/downcast-rs/2.0.0 also looks similar FWIW |
Oh, that's interesting! What's the difference between these two
You're right that github is similar, and I should have glanced over at that rendering first! |
One is the rendered Readme and the other is the main doc comment a rendered by rustdoc |
Oh! That's the important distinction! Thank you! |
Current Behavior
I just published
downcast-rs
v2.0.0 and the documentation appears misformatted even though it appears fine on docs.rs. Compare:This seems due to code within the documentation that is only conditionally run for testing based on whether a feature is enabled:
Effectively, the code block is being started with
```
when thesync
feature is enabled and with```ignore
when it's disabled.Actual code here.
Also:
Expected Behavior
crates.io should render the documentation as well as docs.rs does.
The text was updated successfully, but these errors were encountered: