Skip to main content

Search OfficeIMO

Enter a topic, API type, or PowerShell command.

Documentation Search all OfficeIMO/
Class

YamlWriterOptions

OfficeIMO.Yaml

Namespace
OfficeIMO.Yaml
Assembly
OfficeIMO.Yaml
Source revision
0eef6a5756b9 with working tree changes
Modifiers
sealed

Layout settings for YamlWriter. Indentation follows the three numbers ruamel.yaml made familiar: YamlWriterOptions.MappingIndent, YamlWriterOptions.SequenceIndent and YamlWriterOptions.SequenceDashOffset.

Inheritance

  • object
  • YamlWriterOptions

Remarks

The defaults write key:\n- item, the compact form most real files use (mapping 2, sequence 2, offset 0). Kubernetes manifests and Helm charts usually indent sequences under their key (mapping 2, sequence 4, offset 2), which writes key:\n - item. Output is deterministic: the same calls with the same options always produce the same text. The writer never folds long lines and always ends the stream with a line break.

Usage

Explore 3 API references to this type

This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.

Accepted by parameters 1

Constructors

public YamlWriterOptions() #

Properties

public int MappingIndent { get; set; } #

Gets or sets how far the keys of a nested mapping are indented from their parent key. Defaults to 2; 1 to 9.

public int SequenceIndent { get; set; } #

Gets or sets how far the content of a sequence item under a mapping key is indented from that key. Defaults to 2; it must be at least YamlWriterOptions.SequenceDashOffset + 2 so the dash and a space fit before the content.

public int SequenceDashOffset { get; set; } #

Gets or sets how far the dash of a sequence item under a mapping key is indented from that key. Defaults to 0, which writes key:\n- item; 2 with a sequence indent of 4 writes key:\n - item.

public string NewLine { get; set; } #

Gets or sets the line break, "\n" (the default) or "\r\n".