Repository navigation
Conversation
…nce-field render marker - AddReferenceBookmark(anchorId): the hidden _Ref bookmark (nine digits) over a whole paragraph's text, as Word makes for a reference to a heading or numbered item; reused when one already spans it. - CrossReferenceOptions: PageNumber (PAGEREF; CachedPage from the caller, else 1 and dirty), NumberNoContext (\n), NumberFullContext (\w). - WmlToHtmlConverterSettings/HtmlConversionOptions.StampReferenceFields and the editor render option referenceFields: REF/PAGEREF/NOTEREF results wrapped in span[data-field][data-field-target][data-field-hyperlink]. - WASM bridge AddReferenceBookmark; InsertCrossReference parses options with ParseCrossReferenceOptions; npm session.addReferenceBookmark and the new options. - Tests XR001-XR006. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Python: add_reference_bookmark; CrossReferenceOptions page_number, number_no_context, number_full_context, cached_page (test in test_links_bookmarks.py). stdio: add_reference_bookmark (a mutation). MCP: docxodus_links action add_reference_bookmark and the new insert_cross_reference options in the schema; MCP156. links-bookmarks.json entry. npm bridge method required. CHANGELOG entry. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Cross-references as Word's Cross-reference dialog makes them. They can target a heading or a numbered item, as well as a bookmark.
AddReferenceBookmark(anchorId)puts the hidden bookmark Word allocates for such a reference over a paragraph's text. The bookmark is named_Refplus nine digits. It covers the paragraph's text; the list number is not text, so it stays outside._Refbookmark that already spans exactly that text is reused, and nothing changes.EditResult.BookmarkName, ready forInsertCrossReference.CrossReferenceOptionsgains:PageNumber: aPAGEREF(the target's page) instead of aREF. Its result isCachedPage; without one, the result is1and the field is marked dirty so Word updates it.NumberNoContext(\n) andNumberFullContext(\w).WmlToHtmlConverterSettings.StampReferenceFields(off by default) wraps REF, PAGEREF and NOTEREF results indata-fieldspans that name their bookmark. An editor can then keep each reference whole and follow it, as it already does for PAGE fields.Surfaces
DocxSession.LinksBookmarks.cs, andInternal/ReferenceFieldInstr.csfor building the instruction.addReferenceBookmark, and the newCrossReferenceOptionsfields.add_reference_bookmark, andCrossReferenceOptions.page_number,number_no_context,number_full_contextandcached_page.add_reference_bookmark, which is a mutation.insert_cross_referencetakes the new options through the sharedParseCrossReferenceOptions.docxodus_linksactionadd_reference_bookmark. The new fields are ininsert_cross_reference'soptionsschema. They are new, so they have no flat aliases.tools/op-descriptions/links-bookmarks.json.[Unreleased]→### Added.Tests
DocxSessionCrossReferenceTestsXR001–XR006 cover:McpServerDispatcherTests.MCP156coversadd_reference_bookmark, then a PAGEREF with a cached page.test_links_bookmarks.pycovers reuse, PAGEREF with a cached page, and REF with\n.tsc --noEmitis clean.🤖 Generated with Claude Code