Closed
Description
Hi everyone,
I documented a struct which uses keyboard commands during runtime to do something and I noticed that it looks not as nice as it could be, so I looked around and compared different kbd styles on the internet.
I compare here the github style (A), Stackexchange and Bootstrap (v4)
Which of these styles do you prefer? I would go with the github style, because it's looks nice and clean without any padding. Maybe one could increase the font size.
I would also do a PR, but I wanted to discuss the style before I do that.
So, what are your thoughts? Do you have any different style in mind? To which elements should the rule apply? To all <kbd> tags or just tags inside a docblock
?
Metadata
Metadata
Assignees
Labels
Type
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity
GuillaumeGomez commentedon Dec 21, 2017
What prevents you to add your own style in your crate doc? Because I'm not sure to understand why we'd want that...
GuillaumeGomez commentedon Dec 21, 2017
cc @rust-lang/docs
steveklabnik commentedon Dec 21, 2017
I also prefer the github style.
@GuillaumeGomez to me, this is a regular old HTML element; we should give it a decent style.
QuietMisdreavus commentedon Dec 21, 2017
👍 for the github style.
frewsxcv commentedon Dec 21, 2017
github style looks most like a keyboard key to me, so i'd be favor of that too
hellow554 commentedon Dec 21, 2017
Thank you for your responses <3 what about the rule? Every <kbd> tag or just the ones inside a docblock ?
QuietMisdreavus commentedon Dec 21, 2017
I'd say to make it every
<kbd>
tag, so we can also change the?
help menu to use them as well.steveklabnik commentedon Dec 21, 2017
GuillaumeGomez commentedon Dec 22, 2017
I extend a bit my statement: I'm opposed to this add because it'll be used in too few cases to be interesting to grow the CSS files (I could bet on maximum 5 people, which is just way too low). It doesn't bring anything useful enough to justify any new content. Please remember that new content means more maintenance.
Adding a CSS rule in your own doc crate is far easier and better for everyone in most cases. If we add such a style for an element which is almost never used, should we add a style for every HTML tag as well? Of course not! This is way too specific and it's up to crates' owners, not to rustdoc.
cc @rust-lang/docs
hellow554 commentedon Dec 22, 2017
I may understand your concern, but do not share your opinion.
A tag is just a tag, and kbd should be used to represent input from a keyboard and for that it should be visualized as such. It's not about adding bloat to the css, but to give a nice visual hint to the reader, that this is a keyboard input.
QuietMisdreavus commentedon Dec 22, 2017
I already mentioned a place where rustdoc can use a
<kbd>
style for itself - the help menu. Right now it's skinning<dt>
to get it, but it can move to use<kbd>
tags and get a better style for it if we add it.GuillaumeGomez commentedon Dec 23, 2017
If the PR does the switch (aka removing dt tag and style). Then it's good for me. As long as it's used by rustdoc, no problem.
hellow554 commentedon Jan 15, 2018
As said, sorry for the late response, christmas, new years eve, vacation, ...
Nethertheless, I stumble upon a problem:
As you can see, the +/- section looks a little bit weird, because it's not 1char wide, but 3.
How to deal with this? Align all of the other parts a little bit to the right? Any other recommendations?
GuillaumeGomez commentedon Jan 15, 2018
Sure, no problem. Hope you enjoyed it. :)
Try to move all "keys" a bit to the right so all the column seems centered. And add a bit of margin to the right of the "+/-" keys please.
hellow554 commentedon Jan 15, 2018
I had to change the overall width of the #help box, because else wise the last line would break. I changed the height to auto (can revert that, but I thought it looks nicer) and added inner padding to the
dt
section.Which one do you like more? (center or right aligned)
steveklabnik commentedon Jan 15, 2018
GuillaumeGomez commentedon Jan 16, 2018
I have a slight preference for the second one.
What about you @QuietMisdreavus?
QuietMisdreavus commentedon Jan 16, 2018
I think i like the second one (the centered one) a little more.
hellow554 commentedon Jan 16, 2018
One could also split the + and - keys into different lines
And we wouldn't have the problem with different width of dt tags
GuillaumeGomez commentedon Jan 16, 2018
@hellow554: Indeed, great suggestions!
hellow554 commentedon Jan 17, 2018
Latest commit makes it looks like this, I hope you like it :)
GuillaumeGomez commentedon Jan 17, 2018
Yep, looks great! With this design: 👍
Rollup merge of rust-lang#46938 - hellow554:rustdoc-kbd-style, r=Guil…
Rollup merge of rust-lang#46938 - hellow554:rustdoc-kbd-style, r=Guil…
GuillaumeGomez commentedon Feb 4, 2018
It got merged so it can get closed now.
For reference: #46938