This issue has been created
 
 
Markdown Syntax / cid:jira-generated-image-avatar-3da26b3c-9d7c-4f66-a35d-b6948c12f41c MARKDOWN-93 Open

Content inside HTML tags on their own lines is lost when editing a Markdown page with the WYSIWYG editor

 
View issue   ·   Add comment
 

Issue created

 
cid:jira-generated-image-avatar-7e82527c-77e5-4bfa-b476-682f1cc5de65 Vincent Massol created this issue on 28/Sep/26 09:42
 
Summary: Content inside HTML tags on their own lines is lost when editing a Markdown page with the WYSIWYG editor
Issue Type: cid:jira-generated-image-avatar-3da26b3c-9d7c-4f66-a35d-b6948c12f41c Bug
Affects Versions: 8.2
Assignee: Unassigned
Components: markdown/1.2
Created: 28/Sep/26 09:42
Priority: cid:jira-generated-image-static-major-61f76b3f-2b68-42c2-b4ea-23022b65327d Major
Reporter: Vincent Massol
Description:

Steps to reproduce:

  1. Create a page in the markdown/1.2 syntax with the content:
    before
    
    <div class="red">
    
    *x*
    
    </div>
    
    after
    
  2. Edit the page with the WYSIWYG editor and save it without changes

Expected: the content is unchanged.
Actual: the content becomes the following, so the paragraph inside the div and the closing </div> are lost:

before

<div class="red">

after

Cause: each HTML block is parsed as its own html macro (clean=false), so the opening <div class="red"> and the closing </div> become two unbalanced macros, with the Markdown content as normal blocks between them. The WYSIWYG editor can't round-trip an unbalanced <div>.

Possible solution: parse the whole <div>…</div> block, content included, into a single html macro with clean=false, and render that macro back as the <div> block in Markdown.

Workaround (once MARKDOWN-56 is released): add the data-xwiki-group attribute to the div so it is parsed as a Group.