Add bookmark creation and lookup - #1615
Draft
pseudosavant wants to merge 1 commit into
Draft
pseudosavant wants to merge 1 commit into
pseudosavant wants to merge 1 commit into
Conversation
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.
Problem and behavior
Document generators need public bookmark creation and lookup without replacing existing targets. This adds
Document.bookmarkswithadd(name, paragraph=...),add(name, runs=...), and case-insensitiveget(name). Bookmark proxies expose the stored name and their starting main-story paragraph.Paragraph targets are collapsed ranges at the start of a paragraph. Run ranges cover consecutive direct runs of one paragraph. Body paragraphs and table cells are supported for creation. Invalid names, duplicate names, reversed or nonconsecutive ranges, detached paragraphs, and cross-document or other-story targets are rejected before mutation.
New names use a documented portable subset of Word's 40-character limit. Existing names are preserved. IDs and names in related Word stories are reserved, including unparsed note parts. Lookup includes those names and returns no paragraph proxy for unsupported stories. No rename or deletion behavior is introduced.
Validation
Scope and design
This is a draft for API feedback and relates to #445. It is based directly on upstream master and excludes fork packaging and other fork features.
My fork separately extends the hyperlink authoring API proposed in #1611 with an
anchorargument. That integration is kept in a separate commit so this bookmark API can be reviewed independently. Markdown heading slugs and unresolved-link diagnostics remain in the downstream converter. Names and API conventions can change to follow upstream feedback.