microsoft / microsoft/vscode

Markdown preview does not fallback monospace font in code block if `editor.fontFamily` does not have `monospace` and font does not exist

Open
#324,256 3 comments 1 reaction 0 assignees View on GitHub
Dominant language
TypeScript
Stars
193k
Forks
42.4k
PR merge metrics
PR metrics pending

Description

Does this issue occur when all extensions are disabled?: Yes

- VS Code Version: 1.127.0
- OS Version: macOS 25.2 Tahoe

Steps to Reproduce:

1. Set up the following setting: `"editor.fontFamily": "somejunknonexistingfont"`
2. Open any Markdown file or create a new one with example content:
```
# Example

Here is an example code block in Markdown:

```json
{
"msg01": "HelloWorld",
"prop1": 123456789012
}
```.
```
3. Open preview and observe results:

**Expected**: this code block should be formatted using default monospace font, similar to code editor

**Actual**: this code block has serif formatting applied which is confusing

Image

Contributor guide

Open the contributing guide

Research direction

No source file or test is named. Reproduce the issue with `editor.fontFamily` set to `somejunknonexistingfont`, then trace the Markdown preview's code-block font handling and its use of the editor font setting; done means an invalid or non-monospace setting still produces a monospace fallback in preview.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.