Skip to content

Commit

Permalink
Fix for blade echo highlighting within comments
Browse files Browse the repository at this point in the history
  • Loading branch information
brendt committed Aug 27, 2024
1 parent 6ff070c commit 7ee0367
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
1 change: 1 addition & 0 deletions UPGRADING.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## 2.9.0

- Fix for promoted property hooks (#110)
- Fix for blade echo highlighting within comments (#113)

## 2.8.2

Expand Down
2 changes: 1 addition & 1 deletion src/Languages/Blade/Injections/BladeEchoInjection.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

public function getPattern(): string
{
return '({{)(?<match>.*)(}})';
return '({{(?!--))(?<match>.*)(}})';
}

public function parseContent(string $content, Highlighter $highlighter): string
Expand Down
1 change: 1 addition & 0 deletions tests/Languages/Blade/BladeLanguageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public static function data(): array
{
return [
['{{-- Blade comment --}}', '<span class="hl-comment">{{-- Blade comment --}}</span>'],
['{{-- if --}}', '<span class="hl-comment">{{-- if --}}</span>'],
];
}
}
6 changes: 2 additions & 4 deletions tests/targets/test.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
```php
public function __construct(
public string $username { set => strtolower($value); }
) {}
```blade
{{-- if --}}
```

0 comments on commit 7ee0367

Please sign in to comment.