Skip to content

Commit 8943ea4

Browse files
authored
Fix markdown code block styling (#198351)
Fixes #198183 Remove extra background and also removes the extra divs inside of the code blocks as these were causing issues with styling (extra padding)
1 parent 65b8f67 commit 8943ea4

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

extensions/markdown-language-features/media/markdown.css

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,8 +229,10 @@ pre.hljs code > div {
229229
}
230230

231231
pre code {
232+
display: inline-block;
232233
color: var(--vscode-editor-foreground);
233234
tab-size: 4;
235+
background: none;
234236
}
235237

236238
/** Theming */

extensions/markdown-language-features/src/markdownEngine.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -398,15 +398,14 @@ async function getMarkdownOptions(md: () => MarkdownIt): Promise<MarkdownIt.Opti
398398
lang = normalizeHighlightLang(lang);
399399
if (lang && hljs.getLanguage(lang)) {
400400
try {
401-
const highlighted = hljs.highlight(str, {
401+
return hljs.highlight(str, {
402402
language: lang,
403403
ignoreIllegals: true,
404404
}).value;
405-
return `<div>${highlighted}</div>`;
406405
}
407406
catch (error) { }
408407
}
409-
return `<code><div>${md().utils.escapeHtml(str)}</div></code>`;
408+
return md().utils.escapeHtml(str);
410409
}
411410
};
412411
}

0 commit comments

Comments
 (0)