markdown: Use first word of fenced code block info string as language (#64694)
# Objective
- Fixes #62765
Fenced code blocks with extra content after the language (e.g. ````
```ts import.meta.vitest ````) weren't syntax highlighted, since the
whole info string was used as the language name.
## Solution
- Resolve the language from the first whitespace-separated word of the
info string, per CommonMark. The full info string is still stored, so
mermaid scale options keep working.
## Testing
- Added `test_code_block_language_uses_first_word_of_info_string`.
- Existing `markdown` code block tests pass on Linux.
## Self-Review Checklist:
- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content adheres to Zed's UI standards
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable
---
Release Notes:
- Fixed syntax highlighting for fenced code blocks with extra text after
the language name.
25303a4b25Max Malkin committed on 9/24/2026, 11:06:18 PM· committed by GitHubparent8720fd1