Data Objects
Document
Read the path, frontmatter, body, and raw bytes of a Markdown document in a Package.
Document is the immutable view returned when a knowledge document is read from an OCTX Package. It preserves both the parsed Markdown content and the original bytes referenced by the manifest digest.
Getting the object
OctxPackage.iter_documents() yields Document objects in Package path order:
from octx import open_octx
with open_octx("product-guide.octx") as package:
for document in package.iter_documents():
print(document.path, document.metadata.get("title"))Fields
| Field | Purpose |
|---|---|
path | Markdown path inside the Package. |
metadata | Read-only YAML frontmatter mapping. |
body | Markdown with the frontmatter and optional UTF-8 BOM removed. |
raw | Original bytes referenced by the manifest digest. |
Read boundaries
Document is read-only and never writes modifications back to the Package. Use raw when you need to preserve the original content or recompute a digest. Use body and metadata when displaying, retrieving, or parsing the document content.