diff --git a/src/Renderers/CodeNodeRenderer.php b/src/Renderers/CodeNodeRenderer.php index a450740..5180e47 100644 --- a/src/Renderers/CodeNodeRenderer.php +++ b/src/Renderers/CodeNodeRenderer.php @@ -74,6 +74,9 @@ public function render(): string if ('text' !== $language) { $highLighter = new Highlighter(); $code = $highLighter->highlight(self::LANGUAGES_MAPPING[$language] ?? $language, $code)->value; + + // this allows to highlight the $ in PHP variable names + $code = str_replace('$', '$', $code); } return $this->templateRenderer->render( diff --git a/tests/fixtures/expected/blocks/code-blocks/php-annotations.html b/tests/fixtures/expected/blocks/code-blocks/php-annotations.html index 214408a..fbbd85a 100644 --- a/tests/fixtures/expected/blocks/code-blocks/php-annotations.html +++ b/tests/fixtures/expected/blocks/code-blocks/php-annotations.html @@ -27,7 +27,7 @@ { /** * @Assert\Iban( * message="This is not a valid International Bank Account Number (IBAN)." * ) */ - protected $bankAccountNumber; + protected $bankAccountNumber; } diff --git a/tests/fixtures/expected/blocks/code-blocks/php.html b/tests/fixtures/expected/blocks/code-blocks/php.html index e436e58..2820de9 100644 --- a/tests/fixtures/expected/blocks/code-blocks/php.html +++ b/tests/fixtures/expected/blocks/code-blocks/php.html @@ -26,9 +26,9 @@ namespace Symfony\Component\Routing\Loader\Configurator; return function - (RoutingConfigurator $routes) + (RoutingConfigurator $routes) - { $routes->add('about_us', ['nl' => '/over-ons', 'en' => '/about-us']) ->controller('App\Controller\CompanyController::about'); + { $routes->add('about_us', ['nl' => '/over-ons', 'en' => '/about-us']) ->controller('App\Controller\CompanyController::about'); }; diff --git a/tests/fixtures/expected/blocks/nodes/literal.html b/tests/fixtures/expected/blocks/nodes/literal.html index 11a560c..8408c0e 100644 --- a/tests/fixtures/expected/blocks/nodes/literal.html +++ b/tests/fixtures/expected/blocks/nodes/literal.html @@ -25,8 +25,11 @@
                                     // config/routes.php
 namespace Symfony\Component\Routing\Loader\Configurator; return
-                                    function (RoutingConfigurator $routes) 
-                                    { $routes->add('about_us', ['nl' => '/over-ons', 'en' => '/about-us']) ->controller('App\Controller\CompanyController::about');
+                                    function (RoutingConfigurator $routes) 
+                                    {                                    
+                                        $
+                                        routes
+                                    ->add('about_us', ['nl' => '/over-ons', 'en' => '/about-us']) ->controller('App\Controller\CompanyController::about');
 };
diff --git a/tests/fixtures/expected/main/datetime.html b/tests/fixtures/expected/main/datetime.html index 31c160b..9d0837e 100644 --- a/tests/fixtures/expected/main/datetime.html +++ b/tests/fixtures/expected/main/datetime.html @@ -140,7 +140,10 @@

\ DateTimeType ; - $builder + + $ + builder + -> add( 'startDateTime' @@ -397,7 +400,10 @@

                                                                     // app/config/config.php
-                                                                    $container
+                                                                    
+                                                                        $
+                                                                        container
+                                                                    
                                                                     ->
                                                                     loadFromExtension(
                                                                     'framework'