Skip to content

Commit

Permalink
add char.escape scope to escape sequences in single quoted strings
Browse files Browse the repository at this point in the history
  • Loading branch information
guuido committed Nov 6, 2024
1 parent 3f278fc commit 37adeff
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
11 changes: 4 additions & 7 deletions src/languages/yaml.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,12 @@ export default function(hljs) {
const SINGLE_QUOTE_STRING = {
className: 'string',
relevance: 0,
variants: [
{
begin: /'/,
end: /'/
}
],
begin: /'/,
end: /'/,
contains: [
{
begin: /''/,
match: /''/,
scope: 'char.escape',
relevance: 0
}
]
Expand Down
4 changes: 3 additions & 1 deletion test/markup/yaml/string.expect.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,6 @@
<span class="hljs-attr">key:</span> <span class="hljs-string">&quot;\\&quot;</span>
<span class="hljs-attr">key:</span> <span class="hljs-string">&quot;\&quot;
key: value&quot;</span>
<span class="hljs-attr">key:</span> <span class="hljs-string">value</span>
<span class="hljs-attr">key:</span> <span class="hljs-string">value</span>
<span class="hljs-attr">key:</span> <span class="hljs-string">&#x27;<span class="hljs-char escape_">&#x27;&#x27;</span>&#x27;</span>
<span class="hljs-attr">key:</span> <span class="hljs-string">&#x27;some<span class="hljs-char escape_">&#x27;&#x27;</span>value&#x27;</span>
3 changes: 2 additions & 1 deletion test/markup/yaml/string.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ key: "\\"
key: "\"
key: value"
key: value

key: ''''
key: 'some''value'

0 comments on commit 37adeff

Please sign in to comment.