Skip to content

Commit

Permalink
toml: don't highlight keys with inline tables as tables (#2002)
Browse files Browse the repository at this point in the history
A TOML table looks like:

	[tblname]
	key = 'value'

You can also use inline tables like so:

	[tblname]
	key = 'value'
	inline = {key = 'value'}

However, the "inline" would get highlighted as a table (same as
"[tblname]") rather than a regular key, which is very jarring and
unexpected IMHO.

It looks like it's been like this ever since inline tables were added in
#1359, but I don't think anyone really wants this behaviour.
  • Loading branch information
arp242 committed Dec 3, 2023
1 parent 1687d63 commit 1bdd948
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/rouge/lexers/toml.rb
Expand Up @@ -20,7 +20,7 @@ class TOML < RegexLexer
rule %r/(true|false)/, Keyword::Constant

rule %r/(#{identifier})(\s*)(=)(\s*)(\{)/ do
groups Name::Namespace, Text, Operator, Text, Punctuation
groups Name::Property, Text, Operator, Text, Punctuation
push :inline
end

Expand Down

0 comments on commit 1bdd948

Please sign in to comment.