diff --git a/src/Renderers/CodeNodeRenderer.php b/src/Renderers/CodeNodeRenderer.php index 26f16ff..37d6649 100644 --- a/src/Renderers/CodeNodeRenderer.php +++ b/src/Renderers/CodeNodeRenderer.php @@ -78,6 +78,17 @@ public function render(): string $highlightedCode = preg_replace('/^C:\\\> /m', 'C:\> ', $highlightedCode); } + if ('diff' === $language) { + // remove the '+' and '-' signs so they can be added with css + $highlightedCode = str_replace([ + '-', + '+', + ], [ + ' ', + ' ', + ], $highlightedCode); + } + $numOfLines = \count(preg_split('/\r\n|\r|\n/', $highlightedCode)); $lineNumbers = implode("\n", range(1, $numOfLines)); diff --git a/src/Templates/rtd/assets/css/highlightjs.css b/src/Templates/rtd/assets/css/highlightjs.css index c5d07d3..0b73209 100644 --- a/src/Templates/rtd/assets/css/highlightjs.css +++ b/src/Templates/rtd/assets/css/highlightjs.css @@ -66,3 +66,16 @@ Visual Studio-like style based on original C# coloring by Jason Diamond
             
-                + Added line
-                - Removed line
+                  Added line
+                  Removed line
                 Normal line
-- Removed line
-                + Added line
+  Removed line
+                  Added line
             
         
@@ -28,11 +28,11 @@
             
                 Normal line
-+ Added line
-                - Removed line
+  Added line
+                  Removed line
                 Normal line
-- Removed line
-                + Added line
+  Removed line
+                  Added line