microsoft / microsoft/monaco-editor

[Bug] incorrect hightlight of markdown code when an image is a link

Open
#4,558 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
46.8k
Forks
4.1k
Avg merge
17h 58m
Merged PRs (30d)
1

Description

Reproducible in vscode.dev or in VS Code Desktop?
  • Not reproducible in vscode.dev or VS Code Desktop
Reproducible in the monaco editor playground?
Monaco Editor Playground Link

https://microsoft.github.io/monaco-editor/playground.html?source=v0.49.0#XQAAAAL2AAAAAAAAAABBqQkHQ5NjdMjwa-jY7SIQ9S7DNlzs5W-mwj0fe1ZCDRFc9ws9XQE0SJE1jc2VKxhaLFIw9vEWSxW3yscoh2csNg4vd7GwCdnVlJIl66CpsoGy0dqobEnK0DbGnJHEfhmb5jkVFPVi5wTUVsa-dFNRdK-WKwvCRReyu71F23lmD8bOLNYGX65uEDMK2ZfFCSOtXHy_t6wkE5m2ea_NIiB20aICv3lHyeXL3Ifd09I6sZew5kUL-SMYA1r0OwHkn9FgUV2mh8dWcOdGNlcJn__FV84A

Monaco Editor Playground Code
const value = `[![](./x.png)](./x.html)`;

const myEditor = monaco.editor.create(document.getElementById("container"), {
	value,
	language: "markdown",
	automaticLayout: true,
});
Reproduction Steps

No response

Actual (Problematic) Behavior

the [![ and the ]] mismatched.

Expected Behavior

correctly highlight the code

Additional Context

When I was trying this on vscode.dev, it was not doing highlight at all.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked Monaco Editor Playground reproduction and run the embedded TypeScript example using the markdown language. Compare highlighting for [![](./x.png)](./x.html) with the reported mismatched brackets, then verify that image links are highlighted correctly without regressing ordinary markdown links.

Written by the indexing model from the issue text.

Assessment

Tech stack
markdown, typescript
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.