Skip to content
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

doc: implement fancier rendering for keys #35400

Merged
merged 1 commit into from
Oct 2, 2020
Merged

Conversation

Trott
Copy link
Member

@Trott Trott commented Sep 28, 2020

Minimal CSS and markup changes to implement special rendering for
<kbd> elements.

Checklist

@nodejs-github-bot nodejs-github-bot added doc Issues and PRs related to the documentations. repl Issues and PRs related to the REPL subsystem. labels Sep 28, 2020
@Trott
Copy link
Member Author

Trott commented Sep 28, 2020

Before:
image

After:
image

@Trott
Copy link
Member Author

Trott commented Sep 28, 2020

@nodejs/website What do people think of this? @devsnek suggested it in another PR, and I kind of like it, but also like the simplicity of simply bolding the key name and leaving it at that (the "before" state above). On the other hand, we could go even further and copy the CSS for the <kbd> used by MDN, which I rather like and renders like this:

image

@devsnek
Copy link
Member

devsnek commented Sep 28, 2020

Also this https://snek.dev/keyboard

@nschonni
Copy link
Member

I like the MDN style personally, but I notice they're also wrapping the whole keystroke in an <kbd> as well https://developer.mozilla.org/en-US/docs/Web/HTML/Element/kbd#Representing_keystrokes_within_an_input

@bnb
Copy link
Contributor

bnb commented Sep 28, 2020

I generally like the MDN / GitHub style (see below). I'm generally fine with any of the proposed solutions, though.

GitHub Style

@Trott
Copy link
Member Author

Trott commented Sep 28, 2020

I like the MDN style personally, but I notice they're also wrapping the whole keystroke in an <kbd> as well

Yeah, the standard says that's optional (apparently for clarity) and that "Such precision isn't necessary". I like it semantically, but dislike it from a making-our-markdown-even-more-complex standpoint. I can go either way.

@nschonni
Copy link
Member

nschonni commented Sep 28, 2020

Side thought, this could probably be "enforced" through the remark-node-preset by looking for a regex

@silverwind
Copy link
Contributor

Would also suggest either copying MDN style or adding a subtle box-shadow below so it looks like a key.

Minimal CSS and markup changes to implement special rendering for
`<kbd>` elements.

PR-URL: nodejs#35400
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Denys Otrishko <shishugi@gmail.com>
@Trott
Copy link
Member Author

Trott commented Oct 2, 2020

Landed in aa3746d

@Trott Trott merged commit aa3746d into nodejs:master Oct 2, 2020
@Trott Trott deleted the kbd-render branch October 2, 2020 10:28
danielleadams pushed a commit that referenced this pull request Oct 6, 2020
Minimal CSS and markup changes to implement special rendering for
`<kbd>` elements.

PR-URL: #35400
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Denys Otrishko <shishugi@gmail.com>
@danielleadams danielleadams mentioned this pull request Oct 6, 2020
joesepi pushed a commit to joesepi/node that referenced this pull request Jan 8, 2021
Minimal CSS and markup changes to implement special rendering for
`<kbd>` elements.

PR-URL: nodejs#35400
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Denys Otrishko <shishugi@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc Issues and PRs related to the documentations. repl Issues and PRs related to the REPL subsystem.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants