aaubry / YamlDotNet

YamlDotNet is a .NET library for YAML

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Emitter doesn't handle comments between the mapping value and key

YihaoOct opened this issue · comments

commented

Describe the bug

When there is a comment after a mapping key and before the value, the Emitter doesn't generate the correct YAML output.

Examples are:

Inline comment:

hello: # comment
  - world

Parse it and emit it again, the output will be:

hello # this is a comment:
- world

Standalone comment:

hello:
  # comment
  - world

Parse it and emit it again, the output will be:

hello
# this is a comment
:
- world

To Reproduce

Checkout the branch for this PR: #811

Run and debug the two new test cases, see the broken output.