* Affected components: MediaWiki core, default wikitext parser.
* Engineer(s) or team for initial implementation: Parsing Team.
* Code steward: Parsing Team.
### Motivation
RFC T118517 approved use of semantic HTML5 `<figure>` tags for media content, as described in [[ https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images | Parsoid's spec ]].
However, `<figure>` elements are not considered "phrasing content" in HTML5, and therefore do not capture the proper semantics in all contexts in which media can be used in wikitext. More importantly, the HTML parsing spec causes paragraphs to break around `<figure>` (as would `<div>` or any other tag which is not "phrasing content" in HTML5), so we can not use it for inline figures without breaking rendering.
One solution to that would be for the parser to use `<figure-inline>` tags instead for media in contexts where phrasing content should be used.
The "-inline" suffix comes from the HTML4 block vs inline distinction, where "inline" [[ https://developer.mozilla.org/en-US/docs/Web/HTML/Block-level_elements#Block-level_vs._inline | roughly corresponds ]] with HTML5 phrasing content. At this point, it can be thought of more as a wikitext construct.
Currently, the Parsoid service (as non-default MW parser) already implements this spec as well as a custom `<figure-inline>` element, and that seems to be working well in practice. However, while custom elements are permitted by the standard, there is a concern that we're picking an overly broad name that may eventually lead to conflict.
This RFC is about deciding whether and what element to use in the default parser of MediaWiki core (e.g. by it to both the legacy and Parsoid parsers, or by applying it to Parsoid before it becomes the default).
##### Requirements
//(TBD: Specify the features or criteria that need to b* Decide what HTML structure to use for inline met.)//
* …dia content.
-------
### Exploration
Some options to consider,
-1. Use a vendor prefixed name instead for phrasing content, like `<mw-figure-inline>`
-2. Use a vendor prefixed name in all contexts, instead of the standard `<figure>`, for all around consistency and to avoid breaking paragraphs
-3. Push to get `<figure-inline>` standardized first, since there might be more goodwill if go that route before shipping it
4. Revert to using a non-semantic `<span>` tag for phrasing content
#### Proposal A: Option 3
The #parsing-team would like to champion going forward with option 3 `<figure-inline>` tag as is. It has a shorter-term goal of [[ https://www.mediawiki.org/wiki/Parsing/Parser_Unification | unifying ]] the legacy wikitext parser (#mediawiki-parser) with #parsoid, and getting their media output to match is one step along that road. - Revert to using a non-semantic `<span>` tag for phrasing contentBringing a proposal to a standards body is good idea but we should arrive with use cases, not necessarily solutions.
#### Proposal B: Option 4 (On Last Call)
>>! In T251641#6212416, @Arlolra wrote:
> […]
> The #parsing-team has agreed to revert to using `<span>` tags for this purpose, with the condition that we switch to `<figure>`s in galleries and rewrite CSS rules to ensure we're using `typeof` attributes instead of tag names.
>
> Thanks for helping think this through.
The #parsing-team would like to champion going forward with the `<figure-inline>` tag as is. It has a shorter-term goal of [[ https://www.mediawiki.org/wiki/Parsing/Parser_Unification | unifying ]] the legacy wikitext parser (#mediawiki-parser) with #parsoid, and getting their media output to match is one step along that road. Bringing a proposal to a standards body is good idea but we should arrive with use cases, not necessarily solutions.