Skip to content

Don't insert <br/> within paragraphs, unless the line ends with at least two spaces #1212

@jdhoek

Description

@jdhoek

In Markdown paragraphs may contain hard breaks. To indicate a hard break, a line within a paragraph (but not the last one), may be suffixed with at least two spaces:

https://spec.commonmark.org/0.29/#hard-line-break

This is done to prevent Markdown parsers from interpreting every line break as a hard break. Line breaks are often used in source Markdown documents to keep the maximum line length under a certain bound.

CodiMD seems to parse any line break as a hard break. This is probably a bug.

Versions affected

This happens in 65d8fd2 (May 1, 2019).

Examples

No hard breaks

This Markdown (spaces replaced with for display):

Asperiores␣in␣vitae␣quo␣ratione␣
omnis␣dolorem␣doloribus␣voluptatum. 
Dicta␣laborum␣quasi␣aut␣vel␣est. 

Should generate this HTML:

<p>Asperiores in vitae quo ratione 
omnis dolorem doloribus voluptatum. 
Dicta laborum quasi aut vel est.</p>

CodiMD however, generates:

<p>Asperiores in vitae quo ratione<br/>
omnis dolorem doloribus voluptatum.<br/>
Dicta laborum quasi aut vel est.</p>

Hard breaks

This Markdown (spaces shown as ):

Snow␣in␣my␣shoe␣␣
Abandoned␣␣
Sparrow's␣nest␣␣

Should render as:

<p>Snow in my shoe<br/>
Abandoned<br/>
Sparrow's nest</p>

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions