Skip to content

Code

The code element can be used to display a short code passage in a line of text. The language of the code element can optionally be specified with the lang attribute.

Example

<p>
  A class is defined with the <code lang="java">class</code> keyword.
</p>

Longer passages of code can be displayed with code listings.

Attributes

The code element supports the following attributes:

Attribute Type Default Description
lang CodeLanguage plaintext Short string identifying the language of the code content, such as "plaintext" (no language), "xml", "java" or "cpp".
name xs:Name - Name of this element. Must be unique among all element names in this course variant.
tags TokenList Whitespace-separated list of tags of this element.