yzhang-gh / vscode-markdown

Markdown All in One
https://marketplace.visualstudio.com/items?itemName=yzhang.markdown-all-in-one
MIT License
2.85k stars 322 forks source link

Why the area of markdown code block has no background color after generating HTML #1299

Open 1793033023 opened 1 year ago

1793033023 commented 1 year ago

你好,大佬。请教一下为什么最近通过Markdown All in one 将 Markdown 生成 HTML 时,code 块区域没有背景色了呢?之前生成时明明还有,而且之前生成的 HTML 文件再打开code 块区域也没背景色

yzhang-gh commented 1 year ago

最近好像并没有什么变化,会不会是 print.theme 设置有影响

1793033023 commented 1 year ago

大佬,我调整 print.theme 为 dark 和 light 都没有变化

yzhang-gh commented 1 year ago

😂 那会不会是新装了其它 Markdown 插件,导出 HTML 也会把它们提供的样式导出来的

holyspectral commented 10 months ago

Potentially related: https://github.com/microsoft/vscode/commit/fff3860de98bc2424cfc80d6bb8d7fd94c094597

holyspectral commented 10 months ago

Manually change the markdown.css url to https://cdn.jsdelivr.net/gh/Microsoft/vscode@f56f4e1adc2b5b447375d560ab817fe1ceceb104/extensions/markdown-language-features/media/markdown.css works for me.

yzhang-gh commented 10 months ago

@holyspectral Thanks.

It looks like VS Code moved from the pre-defined background color to a CSS variable.

GitBoyPl commented 8 months ago

Hi. Will be the issue fixed? Or maybe, for now, there is other (not manual editing, albeit holyspectral's hint did the job) override? I love your markdown extension :)

yzhang-gh commented 8 months ago

This is because the exported HTML refers to the latest VS Code Markdown CSS (which had a breaking change). For now you can add a line of <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/Microsoft/vscode@f56f4e1adc2b5b447375d560ab817fe1ceceb104/extensions/markdown-language-features/media/markdown.css"> to the Markdown document so you don't have to change the HTML.

GitBoyPl commented 8 months ago

Thank you very much, I am satisfied with this solution. There are a few more differences between the exported HTML and the preview in VSCode. Can they also be improved this way? E.g. the inline code blocks in VSCode are colored, and in HTML just monospaced, no color.

yzhang-gh commented 8 months ago

It is a known issue #686 (in short, the code span color is dynamic depending on your color theme). Probably you can install another Markdown preview style extension (like the GitHub style mentioned there).

GitBoyPl commented 8 months ago

Thank you for the explanation. Good luck and keep safe.