Skip to content

Instantly share code, notes, and snippets.

@s-kocher
Created November 4, 2019 09:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save s-kocher/409387c9ad445f625a7b42c6492cdb8c to your computer and use it in GitHub Desktop.
Save s-kocher/409387c9ad445f625a7b42c6492cdb8c to your computer and use it in GitHub Desktop.
Github indentation settings

timber/timber#2103

In code examples, I’ve advocated for using spaces instead of tabs because of inconsistencies that came up when viewing code examples in Markdown files in readme files on GitHub (#1955 (comment) or #1890 (comment)). The downside was that when copying code into your project, you’d have to change it to tabs again.

Recently, I stumbled over an interesting thread about this topic on Reddit: Nobody talks about the real reason to use Tabs over Spaces. The main point is that we should use tabs for accessibility reasons. The are different preferences for the indent size, especially for developer with visual impairment.

In this issue, I want to explore the best option to go forward. Apparently, when you define the indent size in the .editorconfig file, GitHub will respect that. It’s also possible to add ?ts=2 or ?ts=4 to the URL to change the indent size. I’ll have to check if the URL parameters overwrite what’s set in .editorconfig. There’s also the possibility to use the Refined GitHub browser extension, which changes the default tab size from 8 to 4, or a Chrome browser extension that changes the tab size only.

Currently, we only define an indent_style in editorconfig:

[*.md]
indent_style = space

We could add indent_size as well as trim_trailing_whitespace.

For the documentation on https://timber.github.io/docs/, we could make use of the tab-size property.

pre {
	-moz-tab-size: 4;
	tab-size: 4;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment