Crate onenote_parser

Crate onenote_parser 

Source
Expand description

A OneNote file parser.

onenote_parser provides a high-level API to parse OneNote notebooks and inspect sections, pages, and their contents. It implements the underlying OneNote file format layers (FSSHTTPB, OneStore, and MS-ONE) and exposes a stable surface for consumers through the Parser type.

The parser targets OneNote files obtained from OneDrive downloads (FSSHTTP packaging). It is read-only and does not aim to support legacy OneNote 2016 desktop files.

§Usage

use onenote_parser::Parser;
use std::path::Path;

let mut parser = Parser::new();
let notebook = parser.parse_notebook(Path::new("My Notebook.onetoc2"))?;
println!("sections: {}", notebook.entries().len());

§Features

  • backtrace: Captures a std::backtrace::Backtrace on parse errors and exposes it via std::error::Error::backtrace().

§Architecture

The parser mirrors the OneNote file format layers:

  • FSSHTTPB: binary packaging used by OneDrive downloads
  • OneStore: revision store embedded in the package
  • MS-ONE: object model for sections, pages, and content
  • onenote: high-level API that resolves references between objects

§Error handling

Most fallible APIs return errors::Result, which wraps an errors::Error containing an error kind. You can format the error for user-facing messages and (with the backtrace feature enabled) access the captured backtrace via std::error::Error::backtrace().

§Input files

Use .onetoc2 and .one files from OneDrive downloads (FSSHTTP packaging). For .onetoc2 files, the parser expects the .one file to be in the same directory. The parser does not support legacy OneNote 2016 desktop files.

§Stability

The public API follows semantic versioning and is intended to be stable.

§References

Modules§

contents
The data that represents the contents of a OneNote section.
errors
OneNote parsing error handling.
notebook
The data that represents a OneNote notebook.
page
The data that represents a OneNote page.
property
Collection of properties used by the OneNote file format.
section
The data that represents a OneNote section.

Structs§

Parser
The OneNote file parser.