You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Code highlighting in README files breaks on multi-word code fence info strings #3438
Package README files (and presumably any other rendered markdown files) that use code fences aren't correctly highlighting when the info string contains multiple words:
This renders syntax highlighting correctly:
```ts
const foo = 1
```
This renders as plain text:
```ts anything-else
const bar = 1
```
The CommonMark spec allows for info strings to contain arbitrary data, and by convention the first word is the language:
The first word of the info string is typically used to specify the language of the code sample, and rendered in the class attribute of the code tag. However, this spec does not mandate any particular treatment of the info string.
In npmx, when marked parses a markdown file, it returns the entire code fence string as lang, and that full string gets passed into shiki, which doesn't recognize it and consequently renders it as plain text.
Activity