Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR will add
lazyYAML
constructor option to support lazy YAML format.Motivation
Directives like to specify color code are sometimes looking like not working. A major cause is that YAML parser recognizes
#
as a comment by following YAML 1.2 spec.As you can see from this highlight, YAML parser will recognize a string until reached
#
, and it treatsfff, #000)
as comment.Wrapping by quotes is a way of around this mis-recognize, but we recieved some negative feedbacks from user of private alpha test.
Logic
We use a heuristic logic to parse YAML when Marpit class is initialized by
lazyYAML: true
.When you are using only supported directives by a plain format like a pair of
{key}:{value}
, we treat a written text after semicolon as value directly.If we detect unknown key or allowed YAML special char, we will fallback a parser to strict YAML.