Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can VS Code's Markdown Preview code blocks match your VS Code theme?

I would like the code blocks in the preview pane of markdown files in VS Code to match the background and syntax highlighting of the code in my VS Code theme.

Is this possible in VS Code or does this require I make a new extension?

I have looked through the following resources and do not have a solid answer: VS Code Extensions, VS Code Markdown, VS Code Themes.

like image 955
Alex Lopez Avatar asked Oct 19 '25 07:10

Alex Lopez


2 Answers

There's a github issue about it. They apparently don't care to change this, but there's a marketplace extension that does it. N.B. I haven't used it, but it's the one the contributor in the github thread suggested.

like image 185
Jared Smith Avatar answered Oct 21 '25 06:10

Jared Smith


This was raised in Codeblocks in Markdown Preview don't use theme colors #84572. A maintainer (Matt Bierner) replied that the Markdown preview builtin to VS Code uses a different mechanism for syntax highlighting- highlight.js, and that this is (or at least was at the time of that writing) by-design, and that if one desires the highlighting to be closer matching, one should look for an extension that does that, such as potentially bierner.markdown-shiki (an extension of theirs which I have no affiliation with, and which has its own limitations, such as this).

like image 44
starball Avatar answered Oct 21 '25 08:10

starball



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!