Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Comments inside maps aren't indented #1392

@BrainStone

Description

@BrainStone

So maybe I'm really doing something very wrong here but when I try to place comments inside a map (I want a comment right before a key) the comments are not indented at all.

So I tried this code

YAML::Emitter out;

out << YAML::BeginMap << YAML::Key << "foo"
    << YAML::BeginMap << YAML::Comment("Comment")
    << YAML::Key << "bar" << YAML::Value << true
    << YAML::EndMap << YAML::EndMap;

I would expect this to output

foo:
  # Comment
  bar: true

but it outputs

foo:
# Comment
  bar: true

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions