Winns
Winns

Reputation: 902

VSCode. Change tab size for markdown code preview

It is possible to change tab size for markdown code preview ? Currently 1 tab = 8 spaces.

Upvotes: 8

Views: 4703

Answers (3)

MingHoang
MingHoang

Reputation: 1

Maybe you should try! \

$~~~~~~~~~~~$ = 10 spaces

Upvotes: -1

Joshua
Joshua

Reputation: 441

If you are referring to the markdown preview window you can apply custom css to manipulate the way it is displayed using the markdown.styles setting.

"markdown.styles": [
        "Style.css"
    ]

If you are referring to the editor window you can set the tab size for markdown files by editing your settings file:

"[markdown]": {
    "editor.tabSize": 4
  }

To access the settings file click File -> Preferences -> Settings

Upvotes: 16

SepCode
SepCode

Reputation: 61

If you want to use that file "https://github.com/SepCode/vscode-markdown-style/blob/master/preview/github.css", we know that "https://raw.githubusercontent.com/SepCode/vscode-markdown-style/master/preview/github.css", the URL is not working.

I have a good idea, we can use Github Pages.

Add a submodule in your repository, like this "git submodule add https://github.com/SepCode/vscode-markdown-style.git". And now we can use the URL "https://sepcode.github.io/vscode-markdown-style/preview/github.css" set markdown.styles.

Step:

  • clone your GitHub pages "git clone https://github.com/SepCode/SepCode.github.io.git"
  • cd SepCode.github.io
  • git submodule add https://github.com/SepCode/vscode-markdown-style.git
  • git commit -am 'added vscode-markdown-style module'
  • git push
  • setting vscode setting.json
    {
        "markdown.styles":["https://sepcode.github.io/vscode-markdown-style/preview/github.css"]
    }
    

the vscode-markdown-style repository is just an example, we should use ourself's CSS file. This way is more convenient and controllable.

Upvotes: 0

Related Questions