microsoft / microsoft/vscode

Markdown Editor (rich webview editor) ignores font size: uses var(--markdown-font-size) but never receives it

Open
#332,732 2 comments 4 reactions 1 assignee Claimed by @TylerLeonhardt View on GitHub
stale triage-needed
Dominant language
TypeScript
Stars
193k
Forks
42.4k
PR merge metrics
PR metrics pending

Description

## Description

The new built-in **Markdown Editor** (`vscode.markdown.editor`, the rich/hybrid webview editor introduced recently) does not honor any font size configuration, even though it clearly was designed to support one.

Its stylesheet (`extensions/markdown-language-features/markdown-editor-out/editor.css`) contains:

```css
font-size: var(--markdown-font-size, 14px);
```

The Markdown preview injects this exact CSS variable into its webview HTML based on the existing `markdown.preview.fontSize` setting (see the preview's HTML template in `dist/extension.js`):

```js
isNaN(t.fontSize) ? "" : `--markdown-font-size: ${t.fontSize}px;`
```

However, the HTML template generated for the Markdown Editor webview only links `editor.css` and passes an initial state of `{ content, documentVersion, readonly, richLinksEnabled, linkPresentationRules }` — **no font size is injected**, so the variable is never defined and the editor always falls back to the hardcoded `14px`.

This looks like an oversight: the editor consumes a variable that nothing ever defines.

## Steps to Reproduce

1. VS Code 1.134.0
2. Set `"markdown.preview.fontSize": 22` in user settings
3. Open a `.md` file → open the built-in "Markdown Editor" from the editor picker
4. Compare with the Markdown preview (`⇧⌘V`)

## Actual

- Preview renders at 22px ✅
- Markdown Editor renders at a fixed ~14px ❌ regardless of settings

## Expected

Either:
1. The Markdown Editor webview should also receive `--markdown-font-size` (and ideally `--markdown-line-height` / `--markdown-font-family`, which are already defined in `editor.css` but likewise never injected), or
2. A dedicated setting such as `markdown.editor.fontSize` should be exposed.

Option 1 would make the existing `markdown.preview.fontSize` setting work immediately.

## Related

- #328116 — `markdown.styles` custom stylesheets are also not applied by this editor (same root pattern: per-webview styling injection missing)
- #328026 — similar configurability request (content width) for this editor

## Environment

- Version: 1.134.0 (110a328ea54b42367b803ec53ee0bf52ef26b419)
- OS: macOS (arm64, Sequoia)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.