microsoft / microsoft/monaco-editor

[Bug] json code block in markdown has no highlight

Open
#3,993 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug json tokenization
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

monaco editor playground link

Monaco Editor Playground Code
// Through the options literal, the behaviour of the editor can be easily customized.
// Here are a few examples of config options that can be passed to the editor.
// You can also call editor.updateOptions at any time to change the options.

var editor = monaco.editor.create(document.getElementById("container"), {
	value: '# aaaa\n\n\n{\n  "type": "object",\n  "properties": {\n    "aaa": {\n      "type": "string",\n      "description": "bbb"\n    }\n  }\n}\n',
	language: "markdown",

	lineNumbers: "off",
	roundedSelection: false,
	scrollBeyondLastLine: false,
	readOnly: false,
	theme: "vs-dark",
});
setTimeout(function () {
	editor.updateOptions({
		lineNumbers: "on",
	});
}, 2000);
Reproduction Steps

Use json code block in markdown editor

Actual (Problematic) Behavior

there is no highlight for json code block in markdown editor

Expected Behavior

highlight for json code block in markdown editor should be exist

Additional Context

No response

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

Open the linked Monaco Editor Playground and reproduce the missing highlighting in a Markdown editor using the supplied code. Investigate the Markdown editor behavior for JSON code blocks, then verify that JSON content receives syntax highlighting without changing the reported reproduction conditions.

Written by the indexing model from the issue text.

Assessment

Tech stack
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.