Repository navigation
Read notebooks kept as one file per page, read-only (#274) - #282
Closed
OskarRabenda wants to merge 1 commit into
Closed
OskarRabenda wants to merge 1 commit into
OskarRabenda wants to merge 1 commit into
Conversation
The first step of storing each page in its own file: this build reads the layout but never writes it, so a device one release behind the writer can still open such a notebook. - serialize.ts: `splitDocument` makes a manifest (labelled `page-files`) and one payload per page; `readPageFilesManifest`, `readPagePayload` and `assemblePageFiles` put the notebook back together. The plain decoder refuses a `page-files` payload, so every whole-file reader sees an unreadable notebook and never saves its pages as empty ones. - model/page-files.ts: page files (`Pages/<id>.md`, one `%%finenotes-page` block), safe paths below the notebook's folder, unique names, and a stat that counts the page files for Home. - InkView: a page-files notebook is shown from its page files and stays held read-only; a page not synced yet shows blank and is read again when its file arrives. - Home: reads such a notebook from its page files, and keys its reads on the page-aware stat, so a page saved alone refreshes the card. Refs #274 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Owner
|
Thanks Oskar, the reader you started is in #286 in a changed layout, so I'm closing this one. Two notebooks in one folder would have shared |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #274. This is step B1 of the per-page storage design (review page: https://claude.ai/artifact/7Rx578iiyCVc9UBhahPjEr).
This build reads the new layout but never writes it, so it can ship one release before the writer. That way an iPad and a laptop a release apart can both open what the newer one writes. It is a draft because it fixes the on-disk format: please agree to the format before it is merged.
Format
v2+page-files:, the notebook's settings and the ordered list[{id, file}].Pages/<id>.mdbeside the notebook file, holding one%%finenotes-pageblock with that page's payload, labelled with the features the page uses..mdbecause Obsidian Sync skips other file types unless each device turns that on.Safety
page-filespayload. Every whole-file reader therefore sees "unreadable" and skips it, including relinking, page transfer, calc notes and page embeds. The view's load guard holds it..mdfiles below the notebook's folder: no.., no absolute paths, no backslashes.Changes
src/model/serialize.ts:splitDocument(the writer, used only by tests until B2),readPageFilesManifest,readPagePayload,assemblePageFiles.src/model/page-files.ts: page file text, names, safe paths, andnotebookStat, which counts page files.src/view/ink-view.ts:src/view/library-pages.ts,library-view.ts:Pages/files, so a page saved alone refreshes the card.src/i18n/en/view.ts: two notices, in English only; other languages show the English until translated.Tested
typecheck,lint,lint:review,format:check,test,build.--maxWorkers=3; with all workers, unrelated tests timed out.tests/model/page-files.test.ts: round trip byte for byte, sizes, refusal by the plain decoder, missing and foreign pages, names, paths.tests/view/ink-view-file.test.ts: shown read-only, nothing written, a late page read on arrival.tests/view/library-pages.test.ts: Home's count and text, a one-file notebook beside aPagesfolder, the stat.Not in this PR (B2, after the design is agreed)
Pages/inOWN_FOLDERS, so it moves and is hidden with the notebook.🤖 Generated with Claude Code