Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

toml: don't highlight keys with inline tables as tables #2002

Merged
merged 1 commit into from
Dec 3, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
toml: don't highlight keys with inline tables as tables
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 Oct 12, 2023
commit 92e91620bd4cc32e86534584598a526133f2eb9e
2 changes: 1 addition & 1 deletion lib/rouge/lexers/toml.rb
Original file line number Diff line number Diff line change
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