code tag is used to insert a line or
block of computer code (for example a command) into a document.
This CNXML:
<para id="codeexample">
Enter the command <code>ls /etc</code> to
get a listing of configuration files.
</para>
Results in this display:
Enter the command ls /etc to
get a listing of configuration files.
This CNXML:
<code display="block" id="popup">
function popUp() {
var popmsg = 'Hello & goodbye';
alert($popmsg);
}
</code>
Results in this display:
function popUp() {
var popmsg = 'Hello & goodbye';
alert($popmsg);
}
Note that ampersand and angle bracket characters (&, <, and >) must be
escaped (what's
this?). Their escaped equivalents are &, <, and >,
respectively. Alternatively,
one can insert <![CDATA[ before
the code text and ]]> after it
(what's
this?) to eliminate the need for escaping.