I realized the width of file in GitHub is much wider than '80' (I set 'rulers' in visual studio code as 80). My files are not beautifully displayed. What value should I set on the 'rulers' in my editor?
-
1Are you talking about the _code_ or the text above it? Is that a Markdown file? Outside of source code blocks, line breaks in Markdown source code shouldn't translate into line breaks in rendered output. Are you manually breaking by ending lines with two spaces? – ChrisGPT was on strike Sep 22 '18 at 13:22
-
It is a Markdown file. Yes, I manually broke the ending lines with two spaces. But now I get it. – juanli Sep 24 '18 at 07:56
1 Answers
Choosing the maximum length of your lines based on what will be "beautiful" on GitHub is ridiculous. There are plenty of good reasons to limit line length (though many programmers go beyond 80 characters these days). Shorter lines are easier to read and can help limit complexity.
The JavaScript snippet you show in your screenshot doesn't appear to contain any "artificial" line breaks. What are you planning to do, cram multiple statements onto a single line just to use up columns? How easy would that be to read?
Select a line length limit to use for your project (80 and 120 characters are popular lengths) and stick with it. If you adopt an existing style guide it will probably come with its own limits. Please, don't choose this based on how it renders on GitHub.
For prose, paragraphs automatically wrap unless you add hard breaks by ending lines with two or more spaces.

- 127,765
- 105
- 273
- 257