Issue #890 new
created an issue

Hello, I've tried to style YAML files but I think the parser should be improved

The following code

resources: some text


<span class="l-Scalar-Plain">resources</span>
<span class="p-Indicator">resources</span>
<span class="l-Scalar-Plain">some text</span>

It should be something like

<span class="nt">resources</span>
<span class="p">resources</span>
<span class="sx">some text</span>

resources is a tag and some text is unquoted string

Comments (6)

  1. David Bronke

    It seems to me this should actually be marked as a bug instead of an enhancement; as it is, using pygmentize -l yaml on the command line seems to highlight nothing but comments, which makes it next to useless. It seems that we should be able to use a dictionary lookup to map from YAMLLexer's tokens to the standard Pygments tokens.

  2. Jesse Tan

    Mapping YAMLLexer tokens to Pygments tokens would also require changing the lexer; current YAML lexer marks almost everything that is not a comment or punctuation in the example.yaml as Literal.Scalar.Plain, which means that everything will be syntax highlighted in the same color. Other syntax highlighters have lexers that seem to better at differentiating keys and values.

  3. Log in to comment