mirror of
https://github.com/storytold/wordcraft.git
synced 2026-11-18 00:15:44 +00:00
Word for the web writes each table of contents entry as a HYPERLINK complex field around the heading's text, a tab and a PAGEREF field. The DOCX reader buffered the whole field into one field object with a flat text result, so the tab was drawn as a box instead of reaching the dotted right tab stop, the page number was no longer a field of its own, and the link could not be followed. Rewriting those fields as w:hyperlink elements makes WordCraft draw the TOC as Word does. A HYPERLINK field, complex or simple, now reads the way a w:hyperlink does: its result stays ordinary content carrying the link (url, url#bookmark or #bookmark from \l), with nested fields kept. It is written back as w:hyperlink; the tooltip (\o) and target frame (\t) are dropped. A HYPERLINK field with no target stays a field. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>