QR code

Avoid Soft Line Breaks Inside a Paragraph

  • Moscow, Russia
  • comments

mood

An email, a document, a research paper, a presentation, and even a JavaDoc code block consist of paragraphs, which are “self-contained units of discourse in writing dealing with a particular point or idea.” Visually, paragraphs are supposed to be separated by a vertical space that is a bit larger than a vertical spacing between lines. To achieve this, for example, in HTML, we wrap paragraphs in the <p> tag, while in LaTeX, we use \par or just an empty line between them. However, some people insert what are calledsoft line breaks” inside paragraphs—this is a bad practice that I suggest you stay away from.

Prêt-à-Porter (1994) by Robert Altman
Prêt-à-Porter (1994) by Robert Altman

This is how a paragraph should look, in HTML (no soft breaks, just <p> and </p>):

<p>Tyler gets me a job as a waiter, after
that Tyler's pushing a gun in my mouth and
saying, the first step to eternal life is you
have to die. For a long time though, Tyler
and I were best friends. People are always
asking, did I know about Tyler Durden.</p>

This is how it would look with soft breaks (<br/>) after each sentence:

<p>Tyler gets me a job as a waiter, after
that Tyler's pushing a gun in my mouth and
saying, the first step to eternal life is you
have to die.<br/>
For a long time though, Tyler and I were best
friends.<br/>
People are always asking, did I know about
Tyler Durden.</p>

Don’t do this.

Let the software format paragraphs for you, deciding where their lines must break to form new lines. By injecting linebreaks into the body of a paragraph, you express distrust in the document formatting software, be it an HTML browser, a LaTeX compiler, or a Javadoc generator. In the end, it looks ugly, because we are much worse designers than the creators of LaTeX or browsers.

sixnines availability badge   GitHub stars