david got a fish trophy!
Resolve Markdown fence info-string aliases for injections.
Review Request #15251 — Created Aug. 25, 2026 and updated
Fence info strings were compared verbatim against the supported
language list, so ```js, ```py, ```sh, and any-case variants like
```Python got no highlighting.
get_language_name_for_info_string()and
MARKDOWN_INFO_STRING_LANGUAGESexisted for exactly this purpose but
had no callers. Injection languages that fail the supported language
check are now resolved through the alias table first.This also changes when
highlight()returnsNone(meaning "fall back to
another highlighter"). It used to returnNonewhen the file-level
captures came up empty, before processing injections. That check was
order-dependent: the capture list shrinks asHIGHLIGHT_IGNOREgrows at
runtime, so a Markdown file containing only fenced code could lose all
highlighting depending on what had been highlighted earlier in the
process.
highlight()now returnsNoneexactly when no capture produced a
highlight span, after injections are collected. This is deterministic
and lets files that tree-sitter cannot style (such as Markdown inline
emphasis, which has no mapped highlight classes) fall back to Pygments.
- Added parametrized tests for aliased fence info strings, which also
cover the order-dependent early return (the parametrized runs share a
process). - Ran all tests.
| Summary | ID |
|---|---|
| ylqlmoswqzqytonysumpkuzzxyuprvpo |