• 
      
    Fish Trophy

    david got a fish trophy!

    Fish Trophy

    Resolve Markdown fence info-string aliases for injections.

    Review Request #15251 — Created Aug. 25, 2026 and updated

    Information

    Review Board
    release-9.x

    Reviewers

    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_LANGUAGES existed 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() returns None (meaning "fall back to
    another highlighter"). It used to return None when the file-level
    captures came up empty, before processing injections. That check was
    order-dependent: the capture list shrinks as HIGHLIGHT_IGNORE grows 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 returns None exactly 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
    Resolve Markdown fence info-string aliases for injections.
    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_LANGUAGES` existed 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()` returns None (meaning "fall back to another highlighter"). It used to return `None` when the file-level captures came up empty, before processing injections. That check was order-dependent: the capture list shrinks as `HIGHLIGHT_IGNORE` grows 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 returns `None` exactly 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. Testing Done: - 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.
    ylqlmoswqzqytonysumpkuzzxyuprvpo
    Checks run (2 succeeded)
    flake8 passed.
    JSHint passed.
    maubin
    1. Ship It!
    2.