Template:Kbd

From OpenMW Wiki
Revision as of 17:13, 15 August 2017 by Darklocq (talk | contribs) (typo)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

input

Documentation

This is a convenient template wrapper for the <kbd>...</kbd> HTML element, the proper markup for user input, broadly defined. It is rendered in monospace by most browsers, and sometimes with some letter-spacing kerning to make it slightly wider than the appearance of <code>...</code> and <samp>...</samp> (wiki.OpenMW.org is not presently doing that spacing stylization, but this could change). This can be used in running text or inside <code>...</code>.

It is usually used for:

  • Material inserted or keys pressed, e.g. in response to a prompt, by the user (in running text or in code examples).
  • Specific keystrokes (in running text), e.g. "the Left-Shift key", or "press Ctrl-V (in Mac OS: Cmd-V) to paste".
    • This can also be done with controller/joystick keys; there are Unicode characters for them: ×, , , .
    • If we want to, we can borrow Wikipedia's Template:Key_press, which actually makes them look like keys, with CSS borders and such. In the interim, just use the current template for this.

It is best to consistently use this template or its underlying element for user input and key presses, rather than overload the use of the <code>...</code> element, because that element on many wikis (including this one) is given a background color and a border, and this can be distracting in running text, especially when used for a single short string. In code, it also doesn't make sense to nest two <code>...</code> elements, but it often does make sense to mark input as such within blocks of "code" in a lose sense of that word.

Usage:

{{kbd|the input here}}

If the content contains a = character, the parameter must be named (as |1=), but this is unlikely to arise.

The template need not be used when what is to be inserted is a variable, though these can be nested, if you want to bother with that level of semantic perfection. E.g.:

Add a <code>data=<kbd><var>/path/to/your/mods/</var>Monster Island 1.0</kbd></code> entry in <samp>openmw.cfg</samp>.

produces:

Add a data=/path/to/your/mods/Monster Island 1.0 entry in openmw.cfg.

For program, script, CS, or OS output, see {{samp}}.

These templates should not be used as a way to just get monospaced font for some other purpose; use <span style="font-family: monospace;">...</span>.