ID:WORK-077Status:done
Extract Shared Media Image Unwrap Utility
Priority:highComplexity:simpleSource:SPEC-028
No incremental history — criteria tracking started on Apr 19.
Media zones must unwrap Markdoc's <p><img/></p> to emit a bare <img> inside the media container. This logic exists inline in realm.ts and faction.ts (~15 lines each) and is missing from recipe.ts and playlist.ts. Extract it into a single shared utility and apply it everywhere.
extractMediaImage() utility (or similar) exported from packages/runes/src/common.tsRenderableNodeCursor's .tag('img') traversal to unwrap paragraph-wrapped imagesrecipe.ts media zone updated to use the utility — <p><img/></p> no longer survives into outputplaylist.ts media zone updated to use the utilityrealm.ts and faction.ts inline unwrap code replaced with calls to the shared utility<div data-name="media"><img .../></div> (no <p> wrapper)realm.ts/faction.ts and the cursor.tag('img').limit(1) pattern from pageSectionProperties<p><img/></p> structure