Fix trailing code blocks in type definitions
Properly handle trailing code items (like closing brackets for
polymorphic variants) by appending them to the unified code block.
Cherry-picked from jonludlam/odoc@55fea14a2
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>