Adding a caption breaks float alignment of image

tested with XWiki 14.10.20

According to https://www.xwiki.org/xwiki/bin/view/XWiki/XWikiSyntaxImages
to align images one should use this syntax:

[[image:img.png||style="float:right"]]

This works (image on the right, text flows around at the left).

To add a caption one should use this syntax:

[[caption>>image:img.png]]

This works.

However, if you combine both (as you might deduce from the description):

[[caption>>image:img.png||style="float:right"]]

the image is on the right and the text flows around at the left, but the caption is separated and is displayed on the left.

This is a very unexpected behavior for the users. Either style=“float:right” should work together with captions or the incompatibility of both parameters should be mentioned in the syntax documentation page.

As a workaround one could use:

[[caption>>image:img.png||data-xwiki-image-style-alignment="end"]]

Another workaround is

(% style="float:right" %)
[[Caption>>image:img.png]]

However, I think the documentation should be updated to recommend data-xwiki-image-style-alignment="end" as this is also what you get when using the WYSIWYG editor. @mleduc any reason why these parameters haven’t been added to the documentation when they were added?

No reason, looks like a miss. I’ll fix that.