Parsoid and PHP parser parse <gallery caption="…"> differently:
- PHP parser only allows internal links (file and category syntax also works, this is probably accidental). No other syntax is allowed, in particular you can't even use italics/bold or templates.
- Parsoid allows all wikitext syntax (although you can't really use block syntax because newlines are turned into spaces).
Note that this is only for the gallery caption, not for captions of individual images in the gallery, which allow all wikitext syntax in both parsers.
Example:
<gallery caption="# List item
Text '''bold''' [[link]] {{ns:-1}}
[[File:Example.jpg|thumb|File in gallery caption]]">
File:Example.jpg|Image caption
</gallery>| PHP parser rendering | Parsoid rendering |
I have no strong opinion on which is the preferred behavior, but it should be the same.
However, this seems to be the only place where we apply such a limitation. Other similar constructs (e.g. functionally similar table caption |+, or syntactically similar <mapframe text="…">) allow all wikitext syntax. It would probably be easier to allow all syntax here.
Historical context:
- T10489: Allow links in <gallery> captions (prior to that, gallery captions were plain text)
- T33517: Cannot use templates in <gallery> caption (declined without rationale)

