Today I Learned How To Change GitHub's Tab Size
March 05, 2020
By default, GitHub renders tabs as 8 spaces. For me, this is a pretty annoying default. I’m glad to have learned 2 ways to change this, one temporary, and another somewhat permanent.
ts query parameter on any page that renders code that has tab indents (ie.
Doing so will render the tabs based on the length provided.
There is no way to globally set this within your GitHub account. However, there is a way to set this per respository.
.editorconfig file to set both the
indent_style = tab indent_size = 4
GitHub is able to recognize the file and respect the settings provided when rendering files.
BONUS: Permanent Way #2
Another option for globally setting the tabs is to use a Chrome Extension.
Extensions like “Tab Size on GitHub” will change the tab size on any code page from the default of 8 to 4.
Take note that using a Chrome Extension might supersede the previously mentioned options since such extensions will most likely be injecting custom CSS.
Source: GitHub Cheat Sheet