Fix thumbnail embed nesting and missing-file captions, load the media module#43
Merged
Conversation
For #15 A `thumb` embed alone on a line rendered as `<p><figure>...</figure></p>`. A `<figure>` is flow content, invalid inside a phrasing-only `<p>`, so browsers auto-close the paragraph and leave a stray empty `<p>` behind it. The HTML is set directly on ParserOutput, so it never passes through RemexHtml to be fixed. After parsing, a paragraph whose only content is a thumbnail file embed is now replaced by the embed node itself, so its `<figure>` is emitted as a sibling of the surrounding blocks, the way wikitext renders a standalone thumbnail. Embeds sharing their paragraph with other content, and inline non-thumbnail embeds, are left untouched, since they render as valid phrasing content in place. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
For #15 A `thumb` embed of a missing file fell through to the plain upload red link, which is labelled only with the alt text, so the caption was silently dropped. A missing file with `thumb` now goes through the same core thumbnail path as an existing one, passing a false File. Core frames a broken-thumb box that keeps the caption visible and puts the upload link inside, the way wikitext renders a missing thumbnail. Missing files without `thumb` keep the bare upload link. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
For #15 Core's Linker::makeThumbLink2() registers mediawiki.page.media -- which powers a thumbnail's magnify affordance -- only when passed a Parser, and the ContentHandler render path has none, so the module was never loaded. The FileEmbedRenderer port now exposes the module(s) a rendered thumbnail needs, and the renderer adds them to the RenderedMarkdown modules whenever the document embeds a thumbnail, mirroring how the code highlighter's modules are added only for highlighted blocks. Metadata-only parses, which render no HTML, add nothing. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
For #15 Promotion leaves a paragraph wrapped once it holds a second embed, but no test exercised that guard, so a mutation dropping it survived. Add a case with two thumbnail embeds in one paragraph asserting both stay wrapped, since promotion handles only the solitary case. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The docblock claimed a thumbnail sharing its paragraph with other content is left wrapped "since they render inline there". That holds for a plain inline image but not for a thumbnail, whose block-level <figure> stays invalid inside the <p>. It is left wrapped because this fix handles only the solitary case, so say that. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
JeroenDeDauw
marked this pull request as ready for review
July 16, 2026 23:50
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
For #15
Fixes three of the four sub-items: the invalid
<p><figure>nesting for a standalonethumb, the dropped caption on a missing-filethumb, and the unloadedmediawiki.page.mediamodule. Sub-item 3 (non-inline media withthumb) and the deferredframe/frameless/alignment/border keywords stay out of scope, so this is a partial fix.