diff options
Diffstat (limited to 'src/ghost_io.zig')
| -rw-r--r-- | src/ghost_io.zig | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/src/ghost_io.zig b/src/ghost_io.zig index e5061ff..ff9f612 100644 --- a/src/ghost_io.zig +++ b/src/ghost_io.zig @@ -37,11 +37,8 @@ pub fn visible(allocator: Allocator, body: []const u8, ghosts: anytype) ![]const /// owns the returned slice. On failure, keep the original Markdown and metadata /// intact rather than continuing with a partially decoded document. /// -/// Offset-only records cannot detect edits that leave all insertion points in -/// bounds and on codepoint boundaries. In that case restore inserts all text at -/// the recorded positions, without guessing new ones. To reject such edits, -/// the caller must verify a separately stored digest of the visible bytes and -/// fall back to the original Markdown on mismatch. +/// Offsets alone cannot say whether the visible bytes were edited: the caller +/// must already know where each ghost belongs in these. pub fn restore(allocator: Allocator, body_visible: []const u8, ghosts: anytype) ![]const u8 { if (ghosts.len != 0 and !std.unicode.utf8ValidateSlice(body_visible)) return error.InvalidUtf8; var removed: usize = 0; |
