There is 1 update.
 
 
Markdown Syntax / cid:jira-generated-image-avatar-9f7ce69d-5810-4c2d-9e9d-aaef98cde695 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
 

1 update

 
cid:jira-generated-image-avatar-ffd55c50-59e2-41e5-9991-b10bf632183b Changes by Vincent Massol on 28/Sep/26 14:29
 
Description: Steps to reproduce:
# Create a page in the {{markdown/1.2}} syntax with the content:
{noformat}
before

<div class="red">

*x*

</div>

after
{noformat}
# 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:
{noformat}
before

<div class="red">

after
{noformat}

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 For {{<div>}}, fixed by MARKDOWN-56 is released (8.10.0 ): add the a {{ data-xwiki-group}} attribute to the {{ < div > }} so it whose opening and closing tags are each alone in their HTML block, balanced at the same nesting level, is now parsed as a Group. The problem remains for other HTML tags written the same way (e.g. {{<details>}}, {{<section>}}), and for {{<div>}}s that don't follow that form.