YamlSyntaxHighlighter

Highlights YAML text: keys, scalars, quoted strings, comments, list markers and block literals.

Declared in src/libs/libwidgets/widgets/YamlSyntaxHighlighter.hpp
Inherits QSyntaxHighlighter

Detailed description

The colors come from the syntax colors of the current SemanticPalette, as in JsonSyntaxHighlighter.

A # starts a comment only at the start of a line or after whitespace, and never inside a quoted string. A number, a boolean and null get their own color only when they are the whole scalar, so the word "true" in a description stays text.

A block literal (| or >, with optional chomping and indentation indicators) is followed by the lines that are more indented than its parent node. The highlighter tracks those lines through the block state of QSyntaxHighlighter: blockLiteralState() encodes the indent of the parent node. A blank line inside the block keeps the state. The first line that is not blank and not more indented ends the block. The content of a block literal is text: a GLSL body under shaderCode is not highlighted as GLSL here (construct-definition-editor §DUD-5d).

See also JsonSyntaxHighlighter.

In this section