@@ -42,20 +42,20 @@ export function registerHighlighter(monaco: typeof Monaco) {
42
42
defaultToken : "string" ,
43
43
tokenizer : {
44
44
root : [
45
- // URLs (must come before comment and edge label rules)
46
- [ / ^ \s * h t t p s ? : \/ \/ [ ^ \s ] + / , "string" ] ,
47
- // \/\/ single-line comment... (but not URLs)
48
- [ / ^ \/ \/ .* | [ ^ : ] \/ \/ .* / , "comment" ] ,
49
- [ / \/ \* / , "comment" , "@comment" ] ,
45
+ // Attributes with quoted values (including URLs), numbers, or words
46
+ [ / \s * \[ \w + \s * = \s * ( [ ' " ] .* ?[ ' " ] | - ? \d * \. ? \d + | \w + ) \] | \s * \[ \w + \] / , "attribute" ] ,
47
+ // URLs (must come after attributes but before edge labels)
48
+ [ / \s * h t t p s ? : \/ \/ [ ^ \s ] + / , "string" ] ,
50
49
// Edge label at start of line (after optional indentation)
51
- [ / ^ \s + [ ^ : \s / ] [ ^ : ] * : / , "type" ] , // Match edge label but exclude URLs by preventing / after :
50
+ [ / ^ \s + [ a - z A - Z ] [ \w - ] * : / , "type" ] , // Match edge label starting with letter
52
51
// Variable pointers (including leading space)
53
52
[ / \( [ ^ ) ] + \) / , "variable" ] ,
54
53
[ / \( [ ^ ) ] + \) / , "variable" ] ,
55
54
// #id and .class combinations (must come before word rule)
56
55
[ / ( # [ \w - ] + ( \. [ a - z A - Z ] [ \w - ] * ) * | \. [ a - z A - Z ] [ \w - ] * ( \. [ \w - ] + ) * ) / , "attribute" ] ,
57
- // Attributes with quoted values or numbers
58
- [ / \[ \w + \s * = \s * ( [ ' " ] [ ^ ' " ] * [ ' " ] | - ? \d * \. ? \d + | \w + ) \] | \[ \w + \] / , "attribute" ] ,
56
+ // \/\/ single-line comment... (but not URLs)
57
+ [ / ^ \/ \/ .* | [ ^ : ] \/ \/ .* / , "comment" ] ,
58
+ [ / \/ \* / , "comment" , "@comment" ] ,
59
59
// Escaped characters (must come before other rules)
60
60
[ / \\ [ [ \] ( ) { } < > : # . \/ ] / , "string" ] ,
61
61
// Spaces
0 commit comments