Spaces
Guide about empty spaces.
# Indentation character
Always use spaces where two (2) spaces are used for indentation.
The usage of tab characters is disallowed.
A tab could be a different number of columns depending on the environment, but a space is always one column.
Adhering to this rule increases the code readability and maintainability significantly.
remark-lint: no-tabs (opens new window)
๐ Correct code for this rule:
Plone is fun!
This line contains 2 space characters.
๐ Incorrect code for this rule:
Note
The ยป
character represents a tab.
Plone is fun!
ยป This line contains a tab character.
Plone is fun!
This line contains 4 space characters.
Plone is fun!
This line contains only 1 space character.
# Before blocks
Always add one (1) blank line before blocks except the first line of the file.
remark-lint: no-consecutive-blank-lines (opens new window) and no-missing-blank-lines (opens new window)
Note
The ยฌ
character represents a line break.
๐ Correct code for this rule:
Plone is fun!
ยฌ
The community is awesome.
๐ Incorrect code for this rule:
Plone is fun!
The community is awesome.
# Maximum line length
In contrast to source code, where lines contain statements that can be almost always be broken up or indented, this rule can not be applied to flowing text.
The author should be able to write sentences and text blocks without worrying about the line length.
This guide advices to avoid using a character limit per line for flowing text, but try to use a maximum line length of 120 characters (including spaces) for all other document elements.
Instead of enforcing a maximum line length, users should use soft line wrapping (opens new window):
- Soft wrapping allows line lengths to visually adjust automatically with adjustments to the width of the user's window or margin settings.
- Using hard wrap inserts actual line breaks in the text at wrap points causing the Markdown to not look like the rendered output - With soft wrapping the actual text is still on the same line but will be rendered by the application like it's divided into several lines. This increases the readability significantly and leads to the same visual result as if a maximum line length with hard line breaks for flowing text would have been used.
- Less writer effort - The author can focus on the content instead of formatting.
remark-lint: maximum-line-length (opens new window)
๐ Correct code for this rule:
> Plone is awesome, in summer and in winter.
Volto is great!
The community is beautiful.
๐ Incorrect code for this rule:
> Plone is always awesome,
in summer and in winter.
You can use it for small and huge sites! It is the base
for many beautiful sites.
# Semantic Line Breaks
Breaking lines semantically (opens new window) consists in writing one sentence or clause per line.
This works especially well for conventional markup languages such as markdown, where consecutive lines are joined with a space, because it does not alter the final output.
At the same time, breaking lines semantically is useful in version control systems that use diffing, because it makes it easier for reviewers to see what changes were made to content.
If you also enabled some vertical rules at specific text lenghts for your code editor, breaking lines semantically will also enabloe you to see on the spot how long your sentences are.
Let's analyze the sentence "All human beings are born free and equal in dignity and rights. They are endowed with reason and conscience and should act towards one another in a spirit of brotherhood." All examples below will render the sentence as one paragraph, but only the correct examples below will make changes to the sentence easier to review using diff and easier to track by the version control system.
๐ Correct code for this rule:
All human beings are born free and equal in dignity and rights.
They are endowed with reason and conscience and should act towards one another in a spirit of brotherhood.
Even Better:
All human beings are born free and equal in dignity and rights.
They are endowed with reason and conscience
and should act towards one another in a spirit of brotherhood.
๐ Incorrect code for this rule:
All human beings are born free and equal in dignity and rights. They are endowed with reason and conscience and should act towards one another in a spirit of brotherhood.
# Trailing
Do not use trailing space to generate a line break, use flowing text style or a blank line to create a new paragraph.
remark-lint: hard-break-spaces (opens new window)
Note
The ยท
character represents a space and the ยฌ
character represents a line break.
๐ Correct code for this rule:
Plone is great!
The community is awesome, too!
Plone is great!ยฌ
The community is awesome, too!
๐ Incorrect code for this rule:
Plone is great!ยทยทยฌ
The community is awesome, too!
Plone is great!ยฌ
The community is awesome, too!
โ Tables