Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 12 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ updates, removal, and the AppImage alternative.
printouts, and OfficeMath equations on the freeform page canvas.
- Imports complete `.onepkg` notebook exports through a guided, validated,
on-disk process with progress and cancellation.
- Opens manifest-free OneNote backup folders as one reconstructed notebook,
preserving nested directories as section groups and selecting the latest
dated copy of each section by default.
- Keeps multiple notebooks open in one workspace with nested section groups,
collapsible navigation, scoped search, complete result paths, and indexing of
page titles and stored content.
Expand All @@ -60,10 +63,15 @@ updates, removal, and the AppImage alternative.
## Open Notebooks

Use **Open Notebook Folder...** for a locally copied OneNote notebook directory,
or **Open OneNote File...** for a standalone `.one` section. Additional notebook
directories join the same searchable workspace without being moved. Notebook
folders placed under the configurable default notebooks location open
automatically on the next launch.
or **Open OneNote File...** for a standalone `.one` section. Use **Open OneNote
Backup Folder...** when a desktop backup contains dated `.one` section copies
but no usable notebook table of contents. The backup opens as one notebook;
folders become nested section groups, while the application menu can refresh
the source or show every backup copy.

Additional notebook directories join the same searchable workspace without
being moved. Notebook and backup folders placed under the configurable default
notebooks location open automatically on the next launch.

## Import a OneNote Package

Expand Down
1 change: 1 addition & 0 deletions crates/onenote-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ onenote_parser.workspace = true
serde.workspace = true
thiserror.workspace = true
typed-path.workspace = true
unicode-normalization.workspace = true
uuid.workspace = true

[dev-dependencies]
Expand Down
24 changes: 22 additions & 2 deletions crates/onenote-core/examples/inspect-source.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
use onenote_core::OneNoteLoader;
use onenote_core::{
BackupFolderLoader, BackupFolderOptions, BackupLoadControl, LoadedNotebook, OneNoteLoader,
};
use std::env;
use std::path::Path;
use std::process::ExitCode;

fn main() -> ExitCode {
Expand All @@ -8,7 +11,7 @@ fn main() -> ExitCode {
return ExitCode::from(2);
};

match OneNoteLoader::default().load(&path) {
match load_source(Path::new(&path)) {
Ok(loaded) => {
let diagnostics = loaded
.notebook
Expand Down Expand Up @@ -48,3 +51,20 @@ fn main() -> ExitCode {
}
}
}

fn load_source(path: &Path) -> Result<LoadedNotebook, String> {
if !path.is_dir() {
return OneNoteLoader::default()
.load(path)
.map_err(|error| error.to_string());
}
let loader = BackupFolderLoader::default();
let control = BackupLoadControl::new();
let inspection = loader
.inspect(path, BackupFolderOptions::default(), &control, |_| {})
.map_err(|error| error.to_string())?;
loader
.load(inspection, &control, |_| {})
.map(|result| result.loaded)
.map_err(|error| error.to_string())
}
Loading
Loading