Skip to content

Code listings

Code listings can be used to show programming code that ranges over multiples lines.

Example

<codelisting lang="java"><![CDATA[public static class HelloWorld {
  public static void main(String[] args) {
    System.out.println("Hello World!");
  }
}]]></codelisting>

Attributes

The codelisting element supports the following attributes:

Attribute Type Default Description
highlight LineNumberRangeList A space-separated list of individual line numbers or line number ranges of the code to highlight. These lines are displayed differently than the other lines so that they can be distinguished by the user.
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.