Okay, but XWiki also shouldn’t produce invalid XHTML 1.0, which it would if it produced <figure>
/<figcaption>
tags in XHTML 1.0 (regardless what the input syntax is) - and it seems also strange to expect these tags in an XHTML 1.0 parser. So I hope we agree that we need to switch to HTML5 for CKEditor or do you really suggest to let the XHTML renderer produce invalid <figure>
/<figcaption>
tags?
My idea was to do this transformation on the server side, not in CKEditor. The HTML5 renderer already produces figure
/figcaption
-tags for the figure macro so we would just need to modify the output such that it is not recognized as a macro and then on the other hand the parser would need to translate the figure
/figcaption
-tags into the macro. As I have already said, I am not sure if this is possible/a good idea as I don’t know the parser/renderer code enough.

But what happens with the other content inside the figure macro that is not an image in this case?.. I think I prefer the native syntax solution.
The idea for me was to keep the figure macro a macro in this case, i.e., remove the macro information only if the content consists only of a figure and (possibly) a caption. In CKEditor 5, there is support for tables inside figure
so we could then also upgrade tables with captions to native CKEditor support.