I’m not sure if this is breaking backwards-compatibility, as I have the impression that we already support block content inside links, just the wrapping elements are not removed: https://rendering.xwiki.org/xwiki/bin/view/Main/WebHome?inputsyntax=xwiki%2F2.1&outputsyntax=html%2F5.0&input=[[(((test)))>>https%3A%2F%2Fxwiki.org]]
#HDemo
In particular:
- There must be no wrapping
<span class="wikiexternallink">
- There must be no wrapping
<p>
While this could create the impression that this is easy to implement, I think this is actually quite difficult to properly implement, in particular:
- CKEditor 4 has no support for nesting block content in links (I have not checked CKEditor 5).
- XWiki syntax parsing only supports this because we are using a separate parser to parse the link label.
- WikiModel also doesn’t support this kind of nesting, thus adapting the XHTML 5 parser or also properly parsing this right in the parser for XWiki syntax will require non-trivial changes in WikiModel. In particular, parsing a link currently automatically triggers the opening of a paragraph even though it should only do that if the link contains just phrasing content (which is not known at that point).
- Our body filter in HTMLCleaner would need to be adjusted to not to wrap
<a>
in a <p>
-tag (in HTML 5) - that’s relatively easy, though, apart from the fact that we cannot simply use the same for HTML 4 and HTML 5.
- It is not clear to me how we should render this in XHTML 1.0 or any other syntax we support (like LaTeX).
Supporting this syntax just for images seems way easier to me as in HTML, WikiModel and Rendering Listener API we just handle this as figure/figure caption and not as (image) reference.