1

I am writing blog using Jekyll on github page.

Instead of using offline editors, I use github online editor which supports markdown very well.

But I when I edit posts, github editor set the default indent size to 8. I tried to change it to 4, but after I save it and reedit this post, github editor reset the indent size to 8.

I am wondering why this happens. How can I set the default indent size to 4 for every file?

Thanks!

enter image description here

Shi
  • 510
  • 1
  • 5
  • 16
  • **See Also**: [How to change tab size on GitHub?](https://stackoverflow.com/q/8833953/1366033) – KyleMit Jan 29 '21 at 15:02
  • 1
    Sept. 2021: you now have an official [GitHub setting](https://stackoverflow.com/a/69271299/6309) – VonC Sep 21 '21 at 15:09

1 Answers1

0

It's not a permanent setting. You can change it for the edit mode with the dropdown you mention and for blob mode by appending ?ts=4 to the URL on a per-file basis.

If you're using chrome, you could use Sindre Sorhus' tab-size-on-github extension that does exactly what you want: Force all tabs to represent 4 spaces always.

kba
  • 1,117
  • 9
  • 20
  • Do you mean appending ?ts=4 to the URL like this? https://github.com/shic/blog/edit/gh-pages/_posts/2016-03-29-Javascript-Basic.markdown?ts=4 This not works for me. Unfortunately, also the Chrome extension not works. Maybe github changed their rules. Thanks for the response any way. – Shi Aug 12 '16 at 09:54
  • The parameter only works in the **view** mode (with `blob` instead of `edit` in the URL). However, this does not work for your example because the setting is not picked up for code embedded in Markdown. – kba Aug 12 '16 at 15:51