Skip to main content

Section 4.14 Programs and Consoles

A <program> will be treated as verbatim text (see Section 3.16), subject to all the exceptions for exceptional characters (see Section 3.14). Indentation will be preserved, though an equal amount of leading whitespace will be stripped from every line, so as to keep the code shifted left as far as possible. So you can indent your code consistently along with your XML indentation. For this reason it is best to indent with spaces, and not tabs. A mix will almost surely end badly, and in some programming languages tabs are discouraged (e.g. Python).

The @language attribute may be used to get some degree of language-specific syntax highlighting. We will eventually provide a table of attribute values here. They are always lowercase, and a first guess might succeed.

A <console> is a transcript of an interactive session in a terminal or console at a command-line. It is a sequence of the following elements, in this order, possibly repeated many times as a group: <prompt>, <input>, and <output>. The <output> is optional, and a <prompt> is only displayed when there is an immediately subsequent <input> (which could be empty). The content is treated as verbatim text (see Section 3.16), subject to all the exceptions for exceptional characters (see Section 3.14).

A <program> or <console> may be wrapped in a <listing>, see Section 4.17.