Published
Why a Highlight Moves When the File Changes
You update a file and a highlight you made months ago is suddenly sitting on the wrong sentence, or gone. This is why — and it has nothing to do with the app forgetting.
You open a document you highlighted months ago. The file's been updated since — re-downloaded, re-exported, corrected — and the highlight is sitting on the wrong sentence, or it's gone entirely. Nothing about your device changed. The file did. Here's why that's normal, not a glitch, and what it would take for a highlight to survive it.
What it is (one-paragraph answer)
A highlight is almost never stored as "this sentence." It's stored as a position: the spine's fourth file, its tenth paragraph, the third character. In EPUB, this addressing scheme is called a Canonical Fragment Identifier, or CFI — numbered steps down into a specific chapter file, then a character offset counted from the start of a line of text. Precise, and it works fine, as long as nothing upstream of that position ever moves.
Nothing promises that. What EPUB 3 adds and what it breaks covers the format in more depth, but the short version for anchoring purposes: a new paragraph inserted earlier in the chapter, a sentence split in two, a whole chapter file regenerated by an export tool — any of these renumber everything after the change point. The character offset is even more exposed, since it's a raw count of text units from the start of a block. Insert a single word upstream and it points at a different letter than it did an hour ago.
Why it matters
This isn't a bug one app has and another doesn't. It's the default outcome of replacing a file, in any format that anchors by position. The clearest confirmation comes from outside the EPUB world entirely: Amazon's own publishing help documentation warns authors that sending an updated manuscript to existing readers may erase the notes and highlights they already made — which is why Amazon restricts these pushes to serious quality fixes, not ordinary wording tweaks. A Kindle file and an EPUB file don't share a format, but they share the problem. Replace the file, and whatever pointed into the old one has nothing left to point at.
It's not limited to annotations that get wiped outright, either. What happens to your highlights when a reading app shuts down is the same fragility from a different angle — data tied to something external only lasts as long as that something does.
Where you'll see it
The usual triggers: downloading a corrected edition of a book you already own, re-exporting a document after fixing a typo in the source, or switching reading apps and re-importing a file that looks identical but was packaged by a different tool. None of these feel like "editing the book" from the reader's side. All of them can renumber the exact positions a highlight depends on.
Part of the reason this isn't guarded against at the format level: the core EPUB 3.3 specification defines the spine and the content documents in it, but says nothing about keeping a position stable across edits. That job is handed off entirely to CFI, and CFI only works by comparing numbers, not meaning. Two exports of "the same" book, from the format's point of view, are just two different documents that happen to look similar.
A highlight differs from a simpler kind of marker in one more way. The bookmark, the highlight, and the note only needs to remember a page — close enough is fine there. A highlight has to remember an exact span of text, which is a much harder thing to keep pointed at correctly once the file underneath it moves.
How Margina handles it
The fix isn't a stricter position system — a highlight anchored only to a sharper number is still anchored to a number. How Margina handles highlights goes into the fuller story; the mechanical version is that a highlight here keeps a short snippet of the text it was made on alongside its position, as a kind of receipt. If the position no longer resolves to the same words, that snippet gives the app something to search for nearby and reattach to — the actual sentence, not just the place it used to be.
That has an honest limit. If the highlighted text itself is gone or rewritten beyond recognition, there's nothing left to match.
Frequently Asked Questions
Why does my highlight jump to a different sentence after I update a file?
The highlight isn't stored as "this sentence" — in most formats it's stored as a position, like the fourth paragraph or the 212th character. When you edit or re-export the file, text shifts, but the old position number doesn't know that happened. The app reopens the file, walks to the same position number, and shows you whatever text is sitting there now, which is often not what you originally highlighted.
Does this happen with Kindle books too, not just EPUB?
Yes. Amazon's own KDP help documentation warns authors that pushing a revised manuscript to existing readers may erase their notes and highlights, which is why updates are restricted to serious quality fixes rather than routine edits. The file-replacement problem is the same regardless of format — only the storage details underneath differ.
Can a highlight break even if the book's text didn't actually change?
It can, if the file was regenerated rather than hand-edited — re-exported from a different tool, or converted between formats. Even an invisible change to the underlying markup can shift the structural path a position-based highlight depends on, even though every word a reader sees looks identical.
Is there a way to make a highlight more resistant to file changes?
Anchor it to the text itself, not only to a position. Some systems store a short snippet of the highlighted text alongside the position number as a kind of receipt — if the position doesn't resolve to the same text anymore, the app can search nearby for that snippet and reattach the highlight to the sentence it actually belongs to.
Conclusion
A highlight is a position, not a sentence, and positions move the moment the file underneath them does — whether that file is an EPUB rebuilt by a different export tool or a Kindle manuscript Amazon pushes out for a quality fix. The fix isn't a more precise number. It's giving the highlight something to recognize besides where it used to be.