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

Add Inline Node for <kbd> HTML Tag #25

Open
tajmone opened this issue Apr 27, 2021 · 1 comment
Open

Add Inline Node for <kbd> HTML Tag #25

tajmone opened this issue Apr 27, 2021 · 1 comment
Labels
enhancement New feature or request

Comments

@tajmone
Copy link
Contributor

tajmone commented Apr 27, 2021

It would be useful to have an inline node for keystrokes, to generate the <kbd> HTML tag.

Possible node tags: [key or just [k.

Example:

[k Ctrl] [k Shift] [k Z]

which would be rendered as:

Ctrl Shift Z

with HTML code:

<kbd>Ctrl</kbd> <kbd>Shift</kbd> <kbd>Z</kbd>

(see below for an alternative node syntax)

Note that in the above example I've inserted spaces between the keys, but many people don't, while others insert the + symbol:

[k Ctrl][k Shift][k Z]

[k Ctrl]+[k Shift]+[k Z]

rendered as:

CtrlShiftZ

Ctrl+Shift+Z

... it's a matter of personal taste, but it should be kept into account in the implementation.

Multi-Keys Node

Also, not how Asciidoctor implements it via the Keyboard Macro:

kbd:[Ctrl+Shift+Z]

(rendered as: Ctrl+Shift+Z)

It's smart because it uses just one keyword to handle multiple keys, using + as a separator (two pluses + + will produce the + key).

So PML could also do that, and instead of the above proposed implementation, could instead:

[k Ctrl+Shift+Z]

CSS Styling

For some nice styling of the keys via ready-to-us CSS stylesheets, see:

IMO, the first link offers the best CSS effects for keys, and also provided different styles.

The second on is beautiful looking, but maybe not so practical for inline styling (keys are too big).

@pml-lang
Copy link
Owner

inline node for keystrokes

Yes, that's one more of the nodes to add soon (after the new parser is ready). Thanks.

A first syntax that comes to mind:

single key:
[key Z]

key combination:
[key Ctrl,Shift,Z]      // no space and no + between
[key Ctrl, Shift, Z]    // space between
[key Ctrl+Shift+Z]      // + between

Needs more thought before implementing. Suggestions are very welcome.

Thanks a lot for the useful links too.

@pml-lang pml-lang added the enhancement New feature or request label May 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants