Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I use an online style.css on the visual studio code markdown preview?

I found a markdown css in the github and I want to use it to preview my vscode's md file. the css file url is: https://raw.githubusercontent.com/sindresorhus/github-markdown-css/gh-pages/github-markdown.css

vscode settings.json:

// Place your settings in this file to overwrite the default settings
{
    "editor.fontFamily": "Consolas, Microsoft YaHei", 
    "editor.fontSize": 16,
    "markdown.styles": [
        "https://raw.githubusercontent.com/sindresorhus/github-markdown-css/gh-pages/github-markdown.css"
    ]
}

But nothing happened. What should I do?

like image 950
Jecvay Liu Avatar asked Sep 05 '15 06:09

Jecvay Liu


People also ask

How do I use CSS style in Markdown?

Markdown does not support CSS styles. Since Markdown converts to HTML, Any valid HTML works. CSS styles are added with inline or style tags in HTML. Disadvantages with this lot of HTML code with plain markdown that makes complex to read and understand.

Can you preview Markdown in VS Code?

VS Code supports Markdown files out of the box. You just start writing Markdown text, save the file with the . md extension and then you can toggle the visualization of the editor between the code and the preview of the Markdown file; obviously, you can also open an existing Markdown file and start working with it.

How do I Preview CSS and HTML in Visual Studio?

For single html file, in VS 2022, you can click File > View in Browser (Ctrl + Shift + W) to preview it(or right-click the white space of this single html file > click View in Browser ).


1 Answers

if you want to use a local .css file such as d:\vscode-markdown.css, then your configuration should be

"markdown.styles": [
    "file:///D:/vscode-markdown.css"
]
like image 107
fred chen Avatar answered Sep 19 '22 10:09

fred chen