rouge icon indicating copy to clipboard operation
rouge copied to clipboard

Comments not highlighted correctly in Makefiles

Open jwbargsten opened this issue 8 months ago • 0 comments

Name of the lexer make

Code sample

build: clean ## build the package
  python -m build

https://rouge.jneen.net/v4.3.0/make/YnVpbGQ6IGNsZWFuICMgYnVpbGQgdGhlIHBhY2thZ2UKCXB5dGhvbiAtbSBidWlsZAo

Additional context In the make.rb lexer, the Comment rule in the state :block_header block should be greedy

--- lib/rouge/lexers/make.rb	2024-06-16 12:56:19.968821924 +0200
+++ lib/rouge/lexers/make.fixed.rb	2024-06-16 12:56:32.721847441 +0200
@@ -81,7 +81,7 @@
       state :block_header do
         rule %r/[^,\\\n#]+/, Name::Function
         rule %r/,/, Punctuation
-        rule %r/#.*?/, Comment
+        rule %r/#.*/, Comment
         rule %r/\\\n/, Text
         rule %r/\\./, Text
         rule %r/\n/ do

jwbargsten avatar Jun 16 '24 10:06 jwbargsten