From 01d53366ee2c880b4a090b0d498fc5d72b8f819c Mon Sep 17 00:00:00 2001 From: Hans Unzner Date: Fri, 29 May 2026 19:07:54 +0200 Subject: [PATCH] Fix # comment for INI without following blank line A comment started with '#' was not rendered as a comment when that comment wasn't followed by an empty line. Also allow leading whitespaces for that comment. --- lib/rouge/lexers/ini.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/rouge/lexers/ini.rb b/lib/rouge/lexers/ini.rb index 500167e2c3..60ad77c8c7 100644 --- a/lib/rouge/lexers/ini.rb +++ b/lib/rouge/lexers/ini.rb @@ -15,7 +15,7 @@ class INI < RegexLexer state :basic do rule %r/\s+/, Text::Whitespace - rule %r/[;#].*?\n/, Comment + rule %r/^[ \t]*[;#][^\n]*(?=\n|\z)/, Comment rule %r/\\\n/, Str::Escape end