Skip to content

Follow-ups for thumb-style image embeds (invalid figure nesting, missing-file caption, media module) #15

Description

@JeroenDeDauw

Follow-ups from #2 / #12 (opt-in thumb framed embeds with visible captions). None blocks the shipped feature; grouped for tracking. Severity is low — everything below renders correctly and is security-clean.

1. Invalid <p><figure> nesting for standalone thumbs (most notable)

[[File:X|thumb|Caption]] on its own line renders as <p><figure typeof="mw:File/Thumb">...</figure></p>. <figure> is flow content, invalid inside a phrasing-only <p>; browsers auto-close the paragraph, so it displays fine but ships invalid HTML5 and leaves a stray empty <p>. This is the common case (a thumb on its own line). The HTML is set directly on ParserOutput and not run through RemexHtml/Tidy. The fix is to promote a solitary block-level embed out of its CommonMark paragraph.

2. Missing file + thumb drops the caption

[[File:Missing.png|thumb|Important caption]] falls through to the upload red link (missingFileHtml), which uses only alt text, so the caption is discarded. Wikitext renders a framed broken-thumb box with the caption.

3. Non-inline media + thumb ignores the keyword

Audio/PDF with thumb renders as a plain file-page link (the !allowInlineDisplay() guard precedes the thumb branch). Consistent with the current minimal subset, but a divergence from wikitext.

4. mediawiki.page.media module not loaded

Linker::makeThumbLink2() only registers the client-side media module when passed a $parser; the renderer passes none, so the magnify affordance is absent. Server-rendered frame and caption are unaffected.

Also deferred from #2: frame/frameless, alignment (left/right/center), border.


Filed by Claude Code (Opus 4.8 (max)) at Jeroen De Dauw's direction, from the code review of #12. Jeroen sets direction and reviews. Identified with Claude Code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions