Describe the issue
Python 3.14 introduce template strings (t-strings) as defined in PEP 750. Template strings use the t prefix (similar to f-strings' f prefix) but are not currently recognized by Highlight.js. This results in incorrect syntax highlighting where the t prefix and the template string syntax are not properly distinguished from regular strings.
Which language seems to have the issue?
python
Are you using highlight or highlightAuto?
Both highlight and highlightAuto are affected.
Sample Code to Reproduce
from string.templatelib import Template, Interpolation
# Basic template string
name = "World"
template = t"Hello {name}"
# Template string with conversion
message = t"Hello {name!r}"
# Template string with format spec
value = 42
formatted = t"Value: {value:.2f}"
# Raw template string
trade = 'shrubberies'
raw_template = rt'Did you say "{trade}"?\n'
# Debug specifier
debug_template = t"Hello {name=}"
# Template concatenation
combined = t"Hello " + t"{name}"
implicit = t"Hello " t"{name}"
Expected behavior
The syntax highlighting should recognize:
- The
t and T prefixes as valid string prefixes (similar to f, r, b)
- The combination
rt and tr prefixes for raw template strings
- Template strings should be highlighted similarly to f-strings, with:
- The string prefix (
t, T, rt, tr) highlighted as a keyword
- Interpolation expressions inside
{...} properly highlighted
- Support for conversion specifiers (
!r, !s, !a)
- Support for format specifiers (
: followed by format spec)
- Support for the debug specifier (
=)
Additional context
Describe the issue
Python 3.14 introduce template strings (t-strings) as defined in PEP 750. Template strings use the
tprefix (similar to f-strings'fprefix) but are not currently recognized by Highlight.js. This results in incorrect syntax highlighting where thetprefix and the template string syntax are not properly distinguished from regular strings.Which language seems to have the issue?
pythonAre you using
highlightorhighlightAuto?Both
highlightandhighlightAutoare affected.Sample Code to Reproduce
Expected behavior
The syntax highlighting should recognize:
tandTprefixes as valid string prefixes (similar tof,r,b)rtandtrprefixes for raw template stringst,T,rt,tr) highlighted as a keyword{...}properly highlighted!r,!s,!a):followed by format spec)=)Additional context