Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Expand allowed characters in keys #4044 #4045

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/languages/yaml.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ export default function(hljs) {
const KEY = {
className: 'attr',
variants: [
// added brackets support
{ begin: /\w[\w :()\./-]*:(?=[ \t]|$)/ },
// added brackets support
{ begin: /\w[\w :()\./*@-]*:(?=[ \t]|$)/ },
{ // double quoted keys - with brackets
begin: /"\w[\w :()\./-]*":(?=[ \t]|$)/ },
begin: /"\w[\w :()\./*@-]*":(?=[ \t]|$)/ },
{ // single quoted keys - with brackets
begin: /'\w[\w :()\./-]*':(?=[ \t]|$)/ },
begin: /'\w[\w :()\./*@-]*':(?=[ \t]|$)/ },
]
};

Expand Down
13 changes: 13 additions & 0 deletions test/markup/yaml/complex-keys.expect.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<span class="hljs-string">&quot;**/.env&quot;</span>

<span class="hljs-string">&quot;/src/kernel.rs&quot;</span>

<span class="hljs-string">&quot;/e2e/**&quot;</span>

<span class="hljs-string">&quot;/__tests__/**&quot;</span>
<span class="hljs-string">&quot;/script/*&quot;</span>

<span class="hljs-string">&quot;/main_test.go&quot;</span>
<span class="hljs-string">&quot;**/packages/*&quot;</span>
<span class="hljs-string">&quot;**/{server,session}*&quot;</span>
<span class="hljs-string">&quot;**/*.m[dk]&quot;</span>
13 changes: 13 additions & 0 deletions test/markup/yaml/complex-keys.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
"**/.env"

"/src/kernel.rs"

"/e2e/**"

"/__tests__/**"
"/script/*"

"/main_test.go"
"**/packages/*"
"**/{server,session}*"
"**/*.m[dk]"