Yaml filter strips comments in some cases

Issue #967 resolved
Chase Tingley created an issue

In many cases, we correctly preserve comments, but in this one, we do not:

map:
  - value1: "hello"
    value2: goodbye
# this is a comment

We originally noticed this when processing the YAML header in a markdown file.

Comments (3)

  1. Denis Konovalyenko

    @Chase Tingley , it looks like the problem scope can be refined a bit. Please consider the following snippets:

    a plain scalar with # a true comment
    

    and

    a plain scalar with
    # a true comment
    

    # a true comment text is ignored as a part of a plain scalar.

    And according to the current specification (1.1), the plain scalars must not contain the :” and #” character sequences as these combinations cause ambiguity with key: value pairs and comments. So, parsing behaviour in such cases can be really implementation-specific…

  2. Log in to comment