This issue has been created
There are 3 updates.
 
 
Markdown Syntax / cid:jira-generated-image-avatar-a580d4c5-c94c-4558-a576-87d3259d712f MARKDOWN-107 Open

New lines in headings or consecutive new lines are rendered incorrectly in CommonMark Markdown 1.2

 
View issue   ยท   Add comment
 

Issue created

 
cid:jira-generated-image-avatar-073033cb-40ca-44da-80be-ee83b1cac5a5 Vincent Massol created this issue on 30/Oct/26 19:37
 
Summary: New lines in headings or consecutive new lines are rendered incorrectly in CommonMark Markdown 1.2
Issue Type: cid:jira-generated-image-avatar-a580d4c5-c94c-4558-a576-87d3259d712f Bug
Affects Versions: 8.9.1
Assignee: Unassigned
Components: markdown/1.2
Created: 30/Oct/26 19:37
Priority: cid:jira-generated-image-static-major-132d9c13-2860-4ba2-9932-38539afb9232 Major
Reporter: Vincent Massol
Description:

When rendering to markdown/1.2, a new line is always rendered as two trailing spaces followed by a line break (a Markdown hard line break). This produces wrong Markdown in some contexts:

  • In a heading: ATX headings can't span several lines, so the text after the new line leaves the heading. E.g. xwiki/2.1 = a\\\\b = (or Markdown # a<br>b) is rendered as # a + 2 spaces, then b on the next line, which becomes a separate paragraph.
  • Consecutive new lines: e.g. xwiki/2.1 a\\\\\\\\b (or Markdown a<br><br>b) is rendered as a + 2 spaces, a line containing only 2 spaces, then b. A line with only spaces is a blank line, so the paragraph is split in two when parsed back.

Expected

The new lines are preserved inside the heading / paragraph (e.g. using <br/> where a hard line break can't be used, or a backslash hard line break).

 
 

3 updates

 
cid:jira-generated-image-avatar-073033cb-40ca-44da-80be-ee83b1cac5a5 Changes by Vincent Massol on 30/Oct/26 19:37
 
Fix Version: 8.10.0
Description: When rendering to {{markdown/1.2}}, a new line is always rendered as two trailing spaces followed by a line break (a Markdown hard line break). This produces wrong Markdown in some contexts:

* *In a heading*: ATX headings can't span several lines, so the text after the new line leaves the heading. E.g. {{xwiki/2.1}} {{= a
\\\\ &#92;&#92; b =}} (or Markdown {{# a<br>b}}) is rendered as {{# a}} + 2 spaces, then {{b}} on the next line, which becomes a separate paragraph.
* *Consecutive new lines*: e.g. {{xwiki/2.1}} {{a
\\\\\\\\ &#92;&#92;&#92;&#92; b}} (or Markdown {{a<br><br>b}}) is rendered as {{a}} + 2 spaces, a line containing only 2 spaces, then {{b}}. A line with only spaces is a blank line, so the paragraph is split in two when parsed back.

h2. Expected

The new lines are preserved inside the heading / paragraph (e.g. using {{<br/>}} where a hard line break can't be used, or a backslash hard line break).
Assignee: Vincent Massol