SuperDoc has two navigation approaches depending on your use case:Documentation Index
Fetch the complete documentation index at: https://docs.superdoc.dev/llms.txt
Use this file to discover all available pages before exploring further.
| Approach | Use case | Stability |
|---|---|---|
scrollToElement(id) | Navigate to any element by its ID | Cross-session (for DOCX-imported content) |
PositionTracker | Track nodes that move during edits | Within a single session |
Navigate by element ID
scrollToElement takes any element ID: paragraph, comment, or tracked change: and scrolls to it. Use doc.extract() to get all IDs at once, or query.match for targeted lookups.
- RAG citations: store
nodeIdalongside embeddings, navigate on click - Cross-references: link to specific paragraphs from external UI
- Search results: scroll to the matching paragraph
- Cross-session addressing: IDs from DOCX-imported content survive reloads
Track nodes during edits
When users edit a document, stored positions can drift. UsePositionTracker so navigation targets stay stable within the current session.
Hyperlinks example
Best practices
- Use
scrollToElementwhen you have an element ID fromdoc.extract()or the Document API. - Use
PositionTrackerwhen you need to follow nodes that move during edits. - For cross-session use, store
nodeIdvalues (notsdBlockId: those regenerate on each open). - Handle missing targets gracefully: both APIs return
falseif the element no longer exists.

