Skip to content

TOML lexer: Support TOML 1.1.0#3027

Merged
birkenfeld merged 2 commits intopygments:masterfrom
encukou:toml-1.1.1
Feb 20, 2026
Merged

TOML lexer: Support TOML 1.1.0#3027
birkenfeld merged 2 commits intopygments:masterfrom
encukou:toml-1.1.1

Conversation

@encukou
Copy link
Copy Markdown
Contributor

@encukou encukou commented Jan 30, 2026

The TOML 1.1.0 changes are:

  • Allow newlines and trailing commas in inline tables
  • Add \xHH notation to basic strings for codepoints ≤255
  • Add \e escape for the escape character (not applicable: pygments allows anything after the backslash)
  • Seconds in datetime and time values are now optional

Ref. the TOML changelog: https://github.com/toml-lang/toml/blob/main/CHANGELOG.md#110--2025-12-18

Fixes #3026

The TOML 1.1.1 changes are:

- Allow newlines and trailing commas in inline tables
- Add \xHH notation to basic strings for codepoints ≤255
- Add \e escape for the escape character
  (not applicable: pygments allows anything after the backslash)
- Seconds in datetime and time values are now optional

Ref. the TOML changelog: https://github.com/toml-lang/toml/blob/main/CHANGELOG.md#110--2025-12-18
@encukou encukou changed the title TOML lexer: Support TOML 1.1.1 TOML lexer: Support TOML 1.1.0 Jan 30, 2026
@birkenfeld
Copy link
Copy Markdown
Member

LGTM, thanks!

@birkenfeld birkenfeld merged commit b03c2ac into pygments:master Feb 20, 2026
15 checks passed
@encukou encukou deleted the toml-1.1.1 branch February 20, 2026 07:48
@Anteru Anteru added this to the 2.20.0 milestone Mar 26, 2026
@Anteru Anteru added the A-lexing area: changes to individual lexers label Mar 26, 2026
nikitabobko added a commit to nikitabobko/AeroSpace that referenced this pull request Mar 27, 2026
TOMLDecoder supports TOML 1.1.0. TOML 1.1.0 finaly allows newlines in inline tables which is a much better syntax than
double square brackets.

I'd love to update the ./docs to prefer inline tables over double square brackets, but pygments color syntax highlighter
doesn't still support it (we use pygments to highlight TOML snippets in the docs)

We need to wait for this PR to land: pygments/pygments#3027
And then the Ruby library to be updated: https://github.com/pygments/pygments.rb

The other motivation is that TOMLDecoder source code seems to be more disciplined

_closes #975
_closes #1064
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-lexing area: changes to individual lexers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TOML 1.1.0

3 participants