Editing YAML Documents
Oxygen XML Editor includes a specialized YAML editor with various editing features for
files that have the
yaml/yml file extension. It includes the usual text editing actions, syntax highlighting, automatic validation, and formatting and indenting. Oxygen XML Editor also includes a document template to help you get started with YAML
documents. The template is called YAML and it can be found in the
New Document folder in the New document wizard.Tip: You can experiment with a sample of a
YAML file available at:
[OXYGEN-INSTALL-DIR]/samples/yaml/personal.yaml.
Format and Indent YAML Documents
Oxygen XML Editor includes support for formatting and indenting
YAML documents. You can trigger a format and indent operation for your YAML document using
the
Format and Indent toolbar
button.
Some of the formatting actions that are performed include:
- Indents the document with the indent size specified in the preferences page.
- Removes empty lines and extra spaces between keys and values.
- Compacts the string values (for example, description) and limits it to 80 characters on a row.
To batch format/indent multiple YAML files, select and right-click the
files in the Project view, then select
Format and Indent
Files.
Contextual Menu Actions
In addition to the usual text editing actions being available in the YAML editor, it also includes some unique actions available in the contextual menu:
- Copy JSON Pointer
- Creates a JSON Pointer at the current cursor location and copies the expression that denotes the JSON pointer to the system clipboard.
- Copy XPath
- Copies the XPath expression of the current property from the current editor to the clipboard.
Toggle Line Comment (Ctrl +
ForwardSlash (Command + ForwardSlash on macOS))- Allows you to comment (or uncomment) the current selection (or current line if no content is selected) in the YAML document you are editing.