Files
wordcraft/crates/docx
e60df31183 M6: footnotes and endnotes from Word files show their number (#103)
Every note Word writes starts with a w:footnoteRef / w:endnoteRef mark,
the note's own number:

  <w:footnote w:id="1"><w:p><w:r><w:rPr><w:rStyle w:val="FootnoteReference"/></w:rPr><w:footnoteRef/></w:r><w:r><w:t> First footnote text.</w:t></w:r></w:p></w:footnote>

The reader skipped the mark, so imported notes read " First footnote
text." with no number. Notes made by references.footnote already start
with a NoteRef to the note itself, which layout numbers like the body's
reference (numFmt from footnotePr/endnotePr included) and the writer turns
back into the mark (#53).

- read_notes reserves the note's part id before reading its text, and the
  mark becomes a NoteRef to that note, with the mark run's formatting. A
  mark outside a note, or of the other kind (w:endnoteRef in a footnote),
  is ignored.
- The writer still writes the mark exactly once per note. When the first
  paragraph holds the note's reference to itself, the mark goes there with
  that reference's formatting (so rStyle FootnoteReference survives the
  save) instead of a plain superscript run at the start.

Co-authored-by: lloyd <lloyd@stackworx.io>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Brandon Thomas <echelon@gmail.com>
2026-10-10 06:56:50 -04:00
..