To take care of things like this you can manually use the doc attribute instead of relying on the /// sugar.
E.g.
/// Documentation relevant to all users.
/// Documentation relevant to all users.
/// Documentation relevant to all users.
///
/// Paragraph that mentions the feature.
#[cfg_attr(feature = "feature", doc = r##"
Paragraph that only appears when feature is enabled.
```
// doctest that only exists when the feature is enabled
```
"##)]
This technique was used in frunk for similar purposes.
P.S. in case it isn't enabled in your default-features, don't forget to enable the feature in [package.metadata.docs.rs] to make sure it appears in online documentation!