Skip to content

Say what a Word header or footer held — the whole part drops without a trace today, though equations and charts get their '(not converted)' markers, so a letter's date or its CONFIDENTIAL status simply vanishes #209

Closed as not planned

Description

@bencode

Problem

A Word document's headers and footers often hold the text that says what it is: the date of a letter, a reference or case number, "CONFIDENTIAL" or "Draft", the chapter of a book. Gamma Reader drops the whole part without a trace — for the reader and for the assistant alike, since both read the same conversion (ui-packages/web/src/formats/docx.ts:89-106).

Reproduction (with the package's own mammoth): build a minimal .docx whose word/header1.xml holds "CONFIDENTIAL - Draft dated 24 October 2026", word/footer1.xml holds "Acme Ltd, Case 4471", and one body paragraph. mammoth.convertToHtml returns exactly <p>The body says this.</p> with messages: [] — no output, no warning.

The codebase already built the machinery for exactly this class of loss, and states its own contract: "Each rule names content Mammoth drops without trace" (ui-packages/web/src/formats/docx-unconverted.ts:48) — equations, charts, diagrams and bare objects all get an italic "(label not converted)" marker in place (:28-45). But markUnconvertedContent only ever opens word/document.xml (:11-12, 91-94); header and footer parts are the unnamed remainder. So a reader asking "when was this written, what is its reference" gets no answer and no hint there was one — and a document marked confidential opens without its marking.

Proposal

  • Extend the unconverted pass to the header and footer parts each section references: sectPr's headerReference/footerReference r:ids, resolved through word/_rels/document.xml.rels (JSZip is already a dependency of this pass).
  • Where each section begins, insert the existing marker voice carrying the part's text — e.g. (Header, not placed: CONFIDENTIAL — Draft dated 24 October 2026) — so the content is neither lost nor silently promoted into the body flow.
  • Skip parts that hold no text (spacing-only headers); documents without headers and footers render exactly as today.

Goal

After this, every header and footer that carries text appears in the converted document, marked as a header or footer at its section, for both the reader and the assistant; nothing a Word author put in those parts is lost silently, and documents without them are unchanged.

Verification

grep -rwiE 'headerReference|footerReference' ui-packages/web/src/formats --include='*.ts' --exclude='*test*'
pnpm --filter @gamma-reader/web test --silent
pnpm --filter @gamma-reader/web exec vitest run --project unit src/formats/docx.test.ts
pnpm check

(the fixture and test to add with the change: a .docx with a text-bearing header and footer converts to markdown that contains both, in the marker voice — today the conversion returns only the body and messages: [], as the reproduction above shows, so no such test can pass)

Refs

Activity

  1. added
    enhancement
    source:scheduled
    on Oct 23, 2026
  2. bencode commented on Oct 23, 2026

    @bencode
    OwnerAuthor

    Independent review — posted by the scheduled issue-reviewer loop (a session separate from the one that files these issues), under the maintainer's standing instruction to evaluate, sharpen, or retire source:scheduled proposals. Audited against main@90b046f (no commits since filing).

    Evidence audit: every citation confirmed, and the reproduction re-run and confirmed verbatim.

    Sensor + Verification block repaired (logged here per policy): lint ✓, but verify falsely passed on unmodified main — the block's commands are the generic suite, and the asserted behavior lives in a test that doesn't exist yet (the block's own parenthetical admits "no such test can pass"). Same disease as #175's block before its repair; unrepaired, a later beat would close this as implemented while nothing had changed. Edited only the Verification block, prepending a gate that fails on main today (confirmed red) and that any implementation of this proposal must turn green — resolving sectPr's references is impossible without these tokens:

    +grep -rwiE 'headerReference|footerReference' ui-packages/web/src/formats --include='*.ts' --exclude='*test*'
     pnpm --filter @gamma-reader/web test --silent

    Re-linted ✓; verify now ✗ on main ✓ (not implemented).

    Verdict: valid, keep open. Two sharpenings for implementation:

    1. Dedup by r:id across sections. Multi-section documents routinely reference the same header part from every section's sectPr; resolving per section and inserting per section would repeat "CONFIDENTIAL" after each chapter. Collect unique header/footer parts by relationship id and mark each once, at the section where it first applies — and pin that in the test (a two-section fixture sharing one header must show the marker exactly once).
    2. The test should assert the marker's text, not mammoth's silence. The deliverable's outcome is the marker voice surviving the full pipeline (italic run → Turndown → markdown), plus proposal bullet 3: a spacing-only header yields nothing, and a header-less document converts byte-identically to today. Assert those three directly rather than only "header text appears".
  3. bencode commented on Oct 26, 2026

    @bencode
    OwnerAuthor

    Closing as not planned. Gamma Reader reads a Word document's body; headers and footers stay out of scope.

    If a header or footer matters, such as a date, a reference number or a confidentiality mark, open the original in Word, or copy that text into a note next to the document so you and the assistant can both see it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementsource:scheduled

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions