From f19db819af34c11645a8e98b5d394dcc1f8142f7 Mon Sep 17 00:00:00 2001 From: Lars Kellogg-Stedman Date: Fri, 29 Apr 2016 12:05:00 -0400 Subject: [PATCH] fix hilighting of YAML keys on first line of code block The YAML highlighter would fail to highlight a key if it occurred on the first line of a `` block, as in:
somekey: somevalue
    anotherkey: anothervalue
This adds "beginning of file" as an acceptable marker for the start of a key. Resolves #942 and, it turns out, #649. --- components/prism-yaml.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/prism-yaml.js b/components/prism-yaml.js index ce8f0836a6..936dc0a16c 100644 --- a/components/prism-yaml.js +++ b/components/prism-yaml.js @@ -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' },