yasuki_core.card_diff.unified_diff#

unified_diff(old, new)[source]#

A GitHub-style unified line diff from old to new.

Parameters:
oldstr

The earlier revision’s rules text (the base).

newstr

The later revision’s rules text (the incoming errata).

Returns:
rowslist of dict

Rows for a single-column diff view, top to bottom. Each row is {"type", "segments"} where type is "context" (unchanged line), "del" (only in old), or "ins" (only in new); segments carry the line text as {"kind", "text"} pieces so a replaced line highlights just the words that changed. A replace is emitted as its del rows followed by its ins rows, lines paired for word-level refinement.