You want to refer to a programming instruction or a DocBook tag, or other XML tag, within the text of a paragraph.
The <code> is used to identify running
text that is a programming instruction or XML tag fragment. The
solutions that use the <code> tag are
presented below. In the section called “IN-Line Code” An, the in-line display of a
programming statement is presented. DocBook and XML tags are handled the section called “In-Line DocBook and XML Tags”.
Use <code>
Example 1. <code> for In-Line Code
Almost all manuals on Basic start with the <code>PRINT "HELLO WORLD"</code> instruction.
Produces the following display:
Figure 1. Published output of Example 1, “<code> for In-Line Code”
Almost all manuals on Basic start with the PRINT
"HELLO WORLD" instruction.
As discussed in the section called “Listing DocBook Content and other XML Markup” displaying DocBook or other XML markup requires the use of CDATA markup or the substitution of a character entity.
Below are two markup alternatives that generate the same result.
This markup substitutes decimal character entity for the brackets - "<" for < and ">" for >:
Example 2. Entity Codes for In-Line Special Characters
To display a DocBook markup fragment use the <code> <programlisting> </code> tag.
Or, this markup uses the CDATA identifier so that with brackets around the tag are processed as characters:
Example 3. CDATA for In-Line Special Characters
To display a DocBook markup fragment use the <code> <![CDATA[<programlisting>]]> </code> tag.
Both of which produce the line below:
Figure 2. Published output of Example 2, “Entity Codes for In-Line Special Characters” and Example 3, “CDATA for In-Line Special Characters”
To display a DocBook markup fragment use the
<programlisting> tag.
code Element Reference in DocBook: The Definitive Guide
