On the usage of empty parameterized paragraphs

Hi everyone,

When transforming the wiki syntax below to an XDOM and rendering it to wiki syntax again, I notice a new line is inserted:

Input

(% class="myclass" %)

Lorem ipsum

Output

(% class="myclass" %)


Lorem ipsum

Then, applying a new transformation to the output keeps adding a new line. I understand the additional new line is inserted to distinguish between the empty paragraph from the next one, but the consequence is that the output’s XDOM is different from the input one. Am I right this means empty parametrized paragraphs are not supported (even if the first rendering will look ok, the XDOM will be altered when refactoring the content eg on backlink renaming) and that a group is always needed when there’s a need to parametrize an empty block? Hence using (% class="myclass" %)((())) instead?

When there’s no content in a paragraph, the (%...%) is considered a parameter of the Paragraph block, and not a Format Block for the content (since there’s no content).

And the canonical way to display paragraph parameters is:

(% ...%)
paragraph content here

So this is why an extra NL is added after (% ... %).

So when you add a Group Block you’re essentially making the (%...%) be considered as a Group Block parameter (and there’s no paragraph anymore ).

Now, what would be the use case of having a formatting block on no element?

The use case I’m seeing in an existing project is the use of an empty block with style for adding custom margin. Probably not a good practice, but seen in a project that I need to migrate. We could also imagine the need to add some data-* attributes for storing some data to be used client side.

The main issue is that we have no syntax to force an empty paragraph. Note: This would also solve [XRENDERING-590] Ability to have an inline macro by itself in a paragraph - XWiki.org JIRA

Now, even with this concept, the users could still fall into this limitation.