Create invisible navigation anchors for cross-references and document navigation.
Essential for long documents, table of contents, and internal hyperlinks with perfect Word compatibility.
OOXML Structure
<!-- Bookmark start and end tags -->
<w:bookmarkStart w:id="0" w:name="chapter1"/>
<w:r>
<w:t>Chapter content here</w:t>
</w:r>
<w:bookmarkEnd w:id="0"/>
<!-- Hyperlink to bookmark -->
<w:hyperlink w:anchor="chapter1">
<w:r>
<w:t>Go to Chapter 1</w:t>
</w:r>
</w:hyperlink>
Use case
- Table of Contents - Create clickable TOC entries that jump to chapters
- Cross-References - Link to figures, tables, or sections elsewhere
- Navigation - Quick jumps in long documents without scrolling
- Index Creation - Mark important terms for automated index generation
- Document Automation - Programmatic navigation and content updates
Commands
insertBookmark
Insert a bookmark at the current cursor position. Bookmarks are invisible navigation anchors used for cross-references and document navigation.
Example:
editor.commands.insertBookmark({ name: 'chapter1' })
editor.commands.insertBookmark({ name: 'introduction', id: 'intro-001' })
import { SuperDoc } from 'superdoc';
import 'superdoc/style.css';
const superdoc = new SuperDoc({
selector: '#editor',
document: yourFile,
onReady: (superdoc) => {
const editor = superdoc.activeEditor;
editor.commands.insertBookmark({ name: 'chapter1' })
editor.commands.insertBookmark({ name: 'introduction', id: 'intro-001' })
},
});
Parameters:
Object with name (required bookmark name) and optional id (unique identifier)
goToBookmark
Navigate to a bookmark by name. Scrolls the document to the bookmark position.
Example:
editor.commands.goToBookmark('chapter1')
import { SuperDoc } from 'superdoc';
import 'superdoc/style.css';
const superdoc = new SuperDoc({
selector: '#editor',
document: yourFile,
onReady: (superdoc) => {
const editor = superdoc.activeEditor;
editor.commands.goToBookmark('chapter1')
},
});
Parameters:
Bookmark name to navigate to
Attributes
BookmarkStart
Bookmark name for cross-references and navigation
Unique identifier for the bookmark
BookmarkEnd
Identifier matching the corresponding bookmarkStart
Source code