For
If a character set is not defined, the system default character set will be used. If the character set is not
recognized or supported, the
As of DITA-OT 3.3, the default character set for code references can be changed by adding the
The character set values are those supported by the Java
Code references can be limited to extract only a specified line range by defining the
Start and end line numbers start from 1 and are inclusive. If the end range is omitted, the range ends on the last line of the file.
Only lines from 5 to 10 will be included in the output.
DITA-OT also supports the line position and range syntax from
Start and end line numbers start from 0 and are inclusive and exclusive, respectively. If the start range is omitted, the range starts from the first line; if the end range is omitted, the range ends on the last line of the file. The format for line position is:
The position line number starts from 0.
Only lines from 5 to 10 will be included in the output.
Instead of specifying line numbers, you can also select lines to include in the code reference by specifying
keywords (or “
DITA-OT supports the
Lines identified using start and end tokens are exclusive: the lines that contain the start token and end token will be not be included. If the start token is omitted, the range starts from the first line in the file; if the end token is omitted, the range ends on the last line of the file.
Given a Haskell source file named
a range of lines can be referenced as:
to include the range of lines that follows the
DITA-OT can adjust the leading whitespace in code blocks to remove excess indentation and keep lines short. Given an XML snippet in a codeblock with lines that all begin with spaces (indicated here as dots “·”),
DITA-OT can remove the leading whitespace that is common to all lines in the code block. To trim the excess
space, set the
In this case, two spaces (“··”) would be removed from the beginning of each line, shifting content to the left by two characters, while preserving the indentation of lines that contain additional whitespace (beyond the common indent):
DITA-OT can be set to display the whitespace characters in code blocks to visualize indentation in PDF output.
To enable this feature, set the
When PDF output is generated, space characters in the code will be replaced with a middle dot or “interpunct”
character (
DITA-OT can be set to add line numbers to code blocks to make it easier to distinguish specific lines.
To enable this feature, set the