Files
Robert SzarkaandClaude 62bfc1feac Docx writer: put a heading's bookmark in its paragraph
The bookmark for a section's id surrounded the whole section, at body
level, so a screen reader met it at the section's last line rather than
at the heading. The docx reader looks for bookmarks only inside
paragraphs, so it never read that one back: the heading got an id from
its text, and links to it kept the bookmark's name, which no longer
matches since bookmark names start with an underscore. Now the bookmark
surrounds the heading's text inside the heading's paragraph, as Word
writes one, and links to headings survive a round trip.

Closes #11845. See also #8825.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-09-30 08:53:55 -07:00

860 B

A heading's bookmark is written inside the heading's paragraph, around its text, rather than around its whole section, so a link to the heading survives a docx round trip, and a screen reader meets the bookmark at the heading (#11845).

% pandoc -f markdown -t docx -o - | pandoc -f docx -t native
# Costs {#price}

Back to [costs](#price), on to [later](#later-part).

# Later Part

End.
^D
[ Header 1 ( "costs" , [] , [] ) [ Str "Costs" ]
, Para
    [ Str "Back"
    , Space
    , Str "to"
    , Space
    , Link ( "" , [] , [] ) [ Str "costs" ] ( "#costs" , "" )
    , Str ","
    , Space
    , Str "on"
    , Space
    , Str "to"
    , Space
    , Link
        ( "" , [] , [] ) [ Str "later" ] ( "#later-part" , "" )
    , Str "."
    ]
, Header
    1
    ( "later-part" , [] , [] )
    [ Str "Later" , Space , Str "Part" ]
, Para [ Str "End." ]
]