Codeblock
The code
directive allows to display code areas in the comment. These are shaded gray in the Library Manager and displayed in monospaced font with color-coded syntax.
Description | The directive markup consists of an explicit markup start (".. ") followed by the type of the directive ( (See also: Directives) |
Principle |
|
Properties |
|
Options
Optionally, a directive block can contain a flat list of code options. The following option is recognized:
Number lines : [start line number] | Each line is preceded by a line number. The optional argument is the number of the first line. Default value is 1. The syntax is not highlighted in color in this case. |
Samples
(In sample project: B_DocuElements\Code Block\FB_Libdoc_CodeBlock)
Code block with color-coded syntax
(*
.. code::
// Attempts to return the value of a boolean property.
FUNCTION GetBooleanProperty : BOOL
VAR_INPUT
sKey: STRING;
END_VAR
// This structure defines a special profile.
TYPE ST_Profile :
STRUCT
nId : INT := -1;
sBuffer : STRING(255) := 'Hello';
END_STRUCT
END_TYPE
*)
Code block with line numbering
(*
.. code::
:number-lines: 1
// Attempts to return the value of a boolean property.
FUNCTION GetBooleanProperty : BOOL
VAR_INPUT
sKey: STRING;
END_VAR
// This structure defines a special profile.
TYPE ST_Profile :
STRUCT
nId : INT := -1;
sBuffer : STRING(255) := 'Hello';
END_STRUCT
END_TYPE
*)