<codeblock>

The <codeblock> element represents lines of program code. Like the <pre> element, line endings and spaces inside the element are preserved, and the content is typically rendered in a monospaced font. This element is part of the DITA programming domain, a special set of DITA elements designed to document programming tasks, concepts, and reference information.

Content models

See appendix for information about this element in OASIS document type shells.

Inheritance

+ topic/pre pr-d/codeblock

Example

This section is non-normative.

<codeblock>
/* a long sample program */
Do forever
  Say "Hello, World"
End
</codeblock>

Content model

(Text | <boolean> | <cite> | <keyword> | <ph> | <q> | <term> | <text> | <xref> | <state> | <coderef> | <data> | <data-about> | <foreign> | <unknown> | <draft-comment> | <fn> | <indextermref> | <indexterm> | <required-cleanup>)*

Not contained by any element.

Zero or more of the following
  • Text
  • <boolean>
  • <cite>
  • <coderef>
  • <data>
  • <data-about>
  • <draft-comment>
  • <fn>
  • <foreign>
  • <indexterm>
  • <indextermref>
  • <keyword>
  • <ph>
  • <q>
  • <required-cleanup>
  • <state>
  • <term>
  • <text>
  • <unknown>
  • <xref>

Not contained by any element.

Inheritance

+ topic/pre pr-d/codeblock

The <codeblock> element is specialized from <pre>. It is defined in the pr-domain module.

Attributes

The following attributes are available on this element: Universal attribute group, Display attribute group, outputclass, xml:space, and spectitle.