Expand description
Structural parser for nb notes, todos, and bookmarks.
Defines NoteDocument — the canonical byte-range partition
for any source file produced or accepted by nb 7.24.0 — plus
the DocumentKind, TodoState, ParseContext, and
accessor types required by the add-note-document-model (P1)
specification.
Permissive acceptance is the contract: parse succeeds for
every input that can be losslessly partitioned into a
NoteDocument, including the frozen W1 and E1-E11
noncanonical forms. The only refusal cases at the parse layer
are [ParseErrorKind::MissingTitle] for Todo/Bookmark files
with no non-blank line. Notes are permissive on empty source.
Mandatory-title/URL/state enforcement belongs to a separate
canonical validator (P5+), not to the parser. Operation
boundaries (do/undo for Todo) enforce checkbox state at
the operation level, not the parse level.
Format dispatch (R3 revision) precedes byte parsing on
ParseContext::FromPath. Files whose final filename matches
a recognized-but-unsupported dotted suffix (e.g., .org,
.latex, .tex, .adoc, .asciidoc) are rejected with
NbError::UnsupportedDocumentFormat before any byte parsing
runs. The list of supported extensions lives in the public
constant SUPPORTED_DOCUMENT_EXTENSIONS.
Structs§
- Body
Fragments - Iterator over body byte ranges.
- Note
Document - A parsed
nbnote, todo, or bookmark. - Tags
Iter - Iterator over tag token byte slices.
- Tags
StrIter - Iterator over tag token string slices, surfacing UTF-8 errors.
Enums§
- Document
Kind - Distinguishes the three document kinds recognized by the parser.
- Parse
Context - How the parser determines the
DocumentKindfor an input. - Todo
State - The parsed checkbox state of a Todo title.
Constants§
- SUPPORTED_
DOCUMENT_ EXTENSIONS - Source-of-truth list of supported document extensions for
format dispatch. The constant is declared in the
parsermodule and re-exported at the crate root asnb_api::SUPPORTED_DOCUMENT_EXTENSIONSper the spec.
Functions§
- parse
- Parse bytes into a
NoteDocument.