Skip to content

Commit

Permalink
fix hilighting of YAML keys on first line of code block
Browse files Browse the repository at this point in the history
The YAML highlighter would fail to highlight a key if it occurred on
the first line of a `<code>` block, as in:

    <pre><code>somekey: somevalue
    anotherkey: anothervalue</pre></code>

This adds "beginning of file" as an acceptable marker for the start of
a key.

Resolves #942 and, it turns out, #649.
  • Loading branch information
larsks committed Apr 29, 2016
1 parent 97b0eb5 commit f19db81
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion components/prism-yaml.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Prism.languages.yaml = {
},
'comment': /#.*/,
'key': {
pattern: /(\s*[:\-,[{\r\n?][ \t]*(![^\s]+)?[ \t]*)[^\r\n{[\]},#]+?(?=\s*:\s)/,
pattern: /(\s*(?:^|[:\-,[{\r\n?])[ \t]*(![^\s]+)?[ \t]*)[^\r\n{[\]},#]+?(?=\s*:\s)/,
lookbehind: true,
alias: 'atrule'
},
Expand Down

0 comments on commit f19db81

Please sign in to comment.