A new diff format for code blocks parses and validates unified-diff/patch text before displaying it
What
A new self-contained unified-diff parser reads Index:/diff/---/+++/@@ headers and hunks into structured objects, validating that the added/removed line counts match what the hunk header claims.
The Code component gained a new format value, "diff", alongside the existing "source" format. When set, the text is validated and parsed through this new parser, and anything with a malformed @@ -a,b +c,d @@ header (missing, non-numeric, or out-of-bound numbers) is rejected with a specific error such as "no @@ hunk header found" or "header is not @@ -a,b +c,d @@ within N lines". A companion wrap prop accepts "wrap" or "truncate-end" to control how long diff lines are displayed.
Why
This lets diff/patch text be rendered as a properly parsed, validated diff view instead of plain text, catching malformed diffs before they're displayed.