paper-docxAPI referencestory
docx.story
paper-docx 0.2.0 API reference
Visibility-complete story traversal and inspection (paper-docx, opt-in).
Standard python-docx traversal (Document.paragraphs, .tables,
iter_inner_content()) is blind to text inside tracked insertions and
deletions, content controls, text boxes, and to entire story parts
(footnotes, endnotes). This module is the new, explicitly named perception
layer: existing traversal semantics are untouched.
Traversal rules:
- Every story part is walked: body, headers, footers, footnotes, endnotes, comments. Separator/continuation-separator footnotes and endnotes are plumbing, not content, and are skipped.
- Paragraphs inside table cells are not emitted as separate blocks — their text belongs to the table block. Paragraphs inside content controls and text boxes ARE emitted, flagged.
mc:AlternateContentcontributes its first supportedmc:Choice, or itsmc:Fallbackwhen none of the choices' required namespaces are supported. Exactly one branch is traversed, so duplicated compatibility content is never counted twice.- Empty paragraphs are emitted — block indices must be stable, and an empty paragraph is a real edit target.
BLIND_REGION_KEYS
attributeBLIND_REGION_KEYS= ('tracked_insertions', 'tracked_deletions', 'moves', 'format_changes', 'content_controls', 'text_boxes', 'fields', 'math', 'embedded_objects', 'alt_chunks', 'hidden_text')VIEWS
attributeVIEWS= ('current', 'original', 'all')