Template:Kbd/Doc

From Octave
< Template:Kbd
Revision as of 06:23, 15 September 2016 by Carandraug (talk | contribs) (documentation copied from wikipedia (still missing a lot of their templates)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Purpose[edit]

This template is for explicitly indicating that the content inside it represents input from a keyboard or other source (speech recognition software, standard input, etc.) It uses the [X]HTML element kbd (keyboard input) which exists for this purpose, and applies some styling to it, namely a faint grey background (borrowed from the related template key press) and slight CSS letter-spacing to suggest individually entered characters. It retains the default monospaced (non-proportional) font style of the Template:Tag element. Because it uses Template:Tag instead of simply applying visual style effects, it is semantic markup that conveys meaning, and it can be further acted upon by the user agent (e.g. with custom local style sheets). This tag is the exact opposite of Template:Tlx, which is for example output.

Usage[edit]

The template takes one mandatory parameter, the content to be marked up. If this content contains "=" (an equals sign), the parameter Template:Em be explicitly named Template:Para, or the template will fail. (This is a limitation of the MediaWiki software, not the template.) It is always safer to use Template:Para syntax. It may be used as a container for Template:Tlx, Template:Tlx or Template:Tag when the example keyboard input contains or consists entirely of a variable. It may also be used with (but not inside) Template:Tlx, or with Template:Tag (it generally should not be used inside the latter, as input is not a part of source code, but something that interacts with it; however, this style can be used to illustrate computer display of mixed type, as illustrated below).

There is an optional parameter Template:Para (or Template:Para or any other value), to get rid of the slight letter spacing, which can look awkward on long passages of input.

Examples:

Some of these examples may look slightly different outside this documentation, because the default background color varies by page type (articles are stark white, template documentation pale green, most other pages very pale grey). In-article example: