Skip to content

[BUG] Markdown line breaks generate invalid XHTML <br> instead of <br /> (fails on Confluence On-Premise) #210

Description

@Alcarmor

Describe the bug
When converting a Markdown file that contains trailing spaces for line breaks, the CLI generates an unclosed <br> tag instead of a valid XHTML tag. This breaks on Confluence On-Premise (Server/Data Center) because its strict XML parser fails to parse the invalid XHTML structure, resulting in a 400 Bad Request error.

To Reproduce
Steps to reproduce the behavior:

  1. Create a Markdown file with trailing spaces for line breaks (like the example below).
  2. Run the CLI command to convert and publish the file.
  3. See error.

Example Markdown content:

# Lines paragraph
**Test Line 1:** line 1  
**Test Line 2:** `line 2`  
**Test Line 3:** line 3

Expected behavior
The CLI should generate valid Confluence Storage Format (XHTML), using a self-closing <br /> tag so that the Confluence On-Premise XML parser can process it without errors.

Environment (please complete the following information):

  • OS: Windows - Node.js version: 24
  • confluence-cli version: 2.15.1
  • Confluence version: Confluence On-Premise 9.2.21

Additional context
Confluence On-Premise uses a strict XML parser. When the CLI outputs an unclosed <br>, the parser throws an error because it encounters a closing

tag while still expecting the <br> tag to be closed.

Error logs
{
"message": "Error parsing xhtml: Unexpected close tag

; expected
.\n at [row,col {unknown-source}]: [4,42]. Log referral number is 4e46484c-a88d-4a72-9184-55f9d241d59f",
"reason": "Bad Request"
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingreleased

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions