Skip to content

Extension README.md preview markdown codeblock language detection #205328

@RedCMD

Description

@RedCMD

The extension README.md preview page does not ignore arguments after the initial whitespace separated languageId ❌

as seen in Github's markdown
and both VSCode's builtin Markdown extensions
all text after the whitespace separator is ignored ✅
(note: json-textmate should fail)

Github: ✅

```json
{
	"key": "value"
}
```

```json textmate
{
	"key": "value"
}
```

```json-textmate
{
	"key": "value"
}
```

Markdown code: ✅
image

Markdown preview: ✅
image

Extension page README.md preview: ❌
image

you can download https://marketplace.visualstudio.com/items?itemName=RedCMD.lag-syntax-highlighter as a simple test extension

PR: #205329

https://github.github.com/gfm/#example-113

"begin": "(^|\\G)(\\s*)(`{3,}|~{3,})\\s*(?i:(json|json5|sublime-settings|sublime-menu|sublime-keymap|sublime-mousemap|sublime-theme|sublime-build|sublime-project|sublime-completions)((\\s+|:|,|\\{|\\?)[^`]*)?$)",

const languageId = languageService.getLanguageIdByLanguageName(lang);

public getLanguageIdByLanguageName(languageName: string): string | null {
const languageNameLower = languageName.toLowerCase();
if (!hasOwnProperty.call(this._lowercaseNameMap, languageNameLower)) {
return null;
}
return this._lowercaseNameMap[languageNameLower];
}

Metadata

Metadata

Assignees

Labels

bugIssue identified by VS Code Team member as probable buginsiders-releasedPatch has been released in VS Code InsidersverifiedVerification succeeded

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions