Skip to content

Commit a356cf4

Browse files
paxcalptclaude
andauthored
chore: scope subscript/superscript delimiters as punctuation.definition (#21)
Follow-up polish from the #17 review. The ~ / ^ delimiters now get their own punctuation.definition.{subscript,superscript}.{begin,end}.rxiv scopes via captures, consistent with the existing markup.bold / markup.italic rules, so themes can style the delimiters independently of the content. Match behaviour is unchanged: the regexes still match H~2~O, CO~2~, E=mc^2^, x^n^ and still ignore ~~strikethrough~~ and [^1] footnotes. Folds into the unreleased 0.3.17 entry (no version bump). Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
1 parent e7451d4 commit a356cf4

2 files changed

Lines changed: 11 additions & 3 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/), and this
77
## [0.3.17] - 2026-05-29
88

99
### Fixed
10-
- **🔧 Subscript/superscript scope leak** - The token colour rule targeted the generic `markup.subscript` / `markup.superscript` TextMate scopes, which other grammars (standard Markdown, AsciiDoc, reStructuredText) also emit. Because `editor.tokenColorCustomizations` is contributed globally, this greyed out subscript/superscript text in every file type, not just rxiv documents. The scopes are now namespaced to `markup.subscript.rxiv` / `markup.superscript.rxiv`, and the grammar gained matching rules for `~subscript~` and `^superscript^`, so the colouring is both scoped to rxiv files and actually applied (the previous rule matched nothing the grammar emitted).
10+
- **🔧 Subscript/superscript scope leak** - The token colour rule targeted the generic `markup.subscript` / `markup.superscript` TextMate scopes, which other grammars (standard Markdown, AsciiDoc, reStructuredText) also emit. Because `editor.tokenColorCustomizations` is contributed globally, this greyed out subscript/superscript text in every file type, not just rxiv documents. The scopes are now namespaced to `markup.subscript.rxiv` / `markup.superscript.rxiv`, and the grammar gained matching rules for `~subscript~` and `^superscript^`, so the colouring is both scoped to rxiv files and actually applied (the previous rule matched nothing the grammar emitted). The `~`/`^` delimiters are also scoped as `punctuation.definition.{subscript,superscript}.{begin,end}.rxiv`, consistent with the bold/italic rules, so themes can style the delimiters independently of the content.
1111

1212
## [0.3.16] - 2026-05-29
1313

syntaxes/rxiv-markdown.tmLanguage.json

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,12 +166,20 @@
166166
},
167167
{
168168
"name": "markup.subscript.rxiv",
169-
"match": "(?<!~)~([^~\\s]+)~(?!~)",
169+
"match": "(?<!~)(~)([^~\\s]+)(~)(?!~)",
170+
"captures": {
171+
"1": {"name": "punctuation.definition.subscript.begin.rxiv"},
172+
"3": {"name": "punctuation.definition.subscript.end.rxiv"}
173+
},
170174
"comment": "Subscript text with ~text~ (e.g. H~2~O); single tilde, no spaces, avoids ~~strikethrough~~"
171175
},
172176
{
173177
"name": "markup.superscript.rxiv",
174-
"match": "\\^([^\\^\\s]+)\\^",
178+
"match": "(\\^)([^\\^\\s]+)(\\^)",
179+
"captures": {
180+
"1": {"name": "punctuation.definition.superscript.begin.rxiv"},
181+
"3": {"name": "punctuation.definition.superscript.end.rxiv"}
182+
},
175183
"comment": "Superscript text with ^text^ (e.g. E=mc^2^)"
176184
},
177185
{

0 commit comments

Comments
 (0)