rust-lang / docs.rs

crates.io documentation generator
https://docs.rs
MIT License
956 stars 193 forks source link

Mark default features with a `(default)` #2532

Open Swatinem opened 6 days ago

Swatinem commented 6 days ago

Fixes #2531 by marking every (transitive) default feature with a (default). The features list is already sorted according to depth-first "default" order first, and according to the number of sub-features.

I changed that so the secondary sort order is alphabetic, as that might make more sense than sorting by number of sub-features.


This was just a quick and dirty hack during RustFest impl Days, and we were discussing some more ideas related to the Features page in general.

GuillaumeGomez commented 6 days ago

Unless you know what the * is about, it's not useful. Why not instead add [FEATURE] (default)?

GuillaumeGomez commented 6 days ago

We still need a visual marker to make it obvious that it's not part of the feature name, hence why I suggested parens. Without parens, we then need some styling.

syphar commented 6 days ago

@GuillaumeGomez currently it looks roughly like this:

grafik

do you mean something else?

GuillaumeGomez commented 6 days ago

The (default) sounds good to me. But I think I misunderstood what you meant in:

  • deffault (default) is perhaps a little much :)
Swatinem commented 6 days ago

I marked this as draft as I will iterate on this a bit more. In particular, I believe it makes sense to also tackle https://github.com/rust-lang/docs.rs/issues/2530 at the same time, as parsing the opaque subfeature into a typed enum would make a ton of sense here as well.

syphar commented 6 days ago

In particular, I believe it makes sense to also tackle #2530 at the same time, as parsing the opaque subfeature into a typed enum would make a ton of sense here as well.

this would be super awesome!