steveklabnik / rustdoc

Not a real thing, see https://github.com/rust-lang/rust for rustdoc's actual source code
https://github.com/rust-lang/rust
104 stars 22 forks source link

Rust cfg_attr style code blocks #235

Closed kbknapp closed 6 years ago

kbknapp commented 6 years ago

Forgive me if this has been addressed, or isn't the proper place, but is there any way to use Rust style cfg statements in the code blocks?

For example, right now I have multiple code blocks I want to ignore on non-unix systems, but use doc tests for unix systems.

So right now my doc comments look like this:

/// Some comments
#[cfg_attr(not(unix), doc = " ```ignore")]
#[cfg_attr(unix, doc = " ```")]
/// // code
/// ```

Which is less than ideal (although it works) and has created a few issues where doc tests were either not functioning correctly, or incorrectly ignored.

It'd be super cool if I could something like

/// Some comments
/// ```cfg_attr(not(unix), ignore)
/// // code
/// ```
steveklabnik commented 6 years ago

Hey, sorry for taking so long!

This isn't the right place to put this; as this is a re-write of rustdoc without a real frontend yet! "how do I use" questions are best asked on users.rust-lang.org. Thanks/sorry!

kbknapp commented 6 years ago

No worries, thanks Steve! :+1: