Growing with the Web

Change the tab size on GitHub using a custom style extension

Published
Tags:

As far as I’m aware you can’t change the tab size on GitHub when viewing code on the web interface (yet). While I’m sure this feature will eventually be added, in the meantime it kind of sucks to write your code using 4 character tabs and then having it mangled up when viewing on the web UI.

Before

But don’t despair, there is a fairly easy fix. We can use the tab-size CSS property to define the tab size on the page.

pre {
  tab-size: 4
}

All we need is some way of injecting it in to the page. StyleBot for Chrome accomplishes this task very nicely, with a handsome, easy to use UI to boot.

StyleBot

Just enter in the style against the URL https://github.com and you’ll be viewing your code in the correct style in no time. tab-size should work in all major desktop browsers except (surprise) IE. Similar extensions should be available for other browsers.

After

Comments

comments powered by Disqus
Like this article?
Subscribe for more!