Namespace: bookmarks

Marked. bookmarks

Bookmark handling methods and properties

Properties:
Name Type Description
currentMark number

Currently focused bookmark for navigation

visible boolean

Are bookmarks currently expanded

Source:
bookmarks.js

Requires

Methods


add(num, byHeadline)

Add a bookmark or replace at specified index for current location

Parameters:
Name Type Description
num number

Bookmark index to add or replace at

byHeadline boolean

Bookmark nearest headline

Source:
bookmarks.js
Returns:

Success or failure

Type
boolean
Example
// Adds a bookmark for current position to first available slot 0-9
Marked.bookmarks.add();

bind(bool)

Enable or disable resize and update events

Parameters:
Name Type Description
bool boolean

whether to enable or disable bound events

Source:
bookmarks.js
Example
// Enables resize and update listeners
Marked.bookmarks.bind(true);
// Disables listeners
Marked.bookmarks.bind(false);

clearAll()

Clear all stored bookmarks

Source:
bookmarks.js
Example
Marked.bookmarks.clearAll();

clearCurrent()

Clear the currently focused bookmark

Source:
bookmarks.js
Example
Marked.bookmarks.clearCurrent();

get(index)

Retrieve a collection of bookmarks or specific bookmark for the document

Parameters:
Name Type Description
index number

if set return bookmark at specific index

Source:
bookmarks.js
Returns:

array of objects [{x:0,y:0,el:elementID[,elOffset:offset]}] or single object

Type
array
Example
// returns all bookmarks as an array
Marked.bookmarks.get();
// returns bookmark at index 1 (2nd bookmark)
Marked.bookmarks.get(1);

getPosition(index)

Get the current position of a bookmark, accounting for collapsed sections

Parameters:
Name Type Description
index number

Index of bookmark to retrieve

Source:
bookmarks.js
Returns:

Bookmark object {x,y,el,[elOffset]}

Type
object
Example
Marked.bookmarks.getPosition(2);

hide()

Compresses bookmarks to their almost-hidden size

Source:
bookmarks.js
Example
Marked.bookmarks.hide();

highlight()

Update the position of the scroll highlight on the minimap

Source:
bookmarks.js
Example
Marked.bookmarks.highlight();

save()

Store bookmark array to app memory

Source:
bookmarks.js
Example
Marked.bookmarks.get();
Marked.bookmarks.save();

scrollToIndex(index)

Scroll to document position by bookmark index

Parameters:
Name Type Description
index number

Index in bookmarks array

Source:
bookmarks.js
Example
Marked.bookmarks.scrollToIndex(3);

set(index)

Set and store the current bookmark index for navigation

Parameters:
Name Type Description
index number

index of bookmark to set

Source:
bookmarks.js
Example
Marked.bookmarks.set(4)

show()

Displays minimap and bookmarks

Source:
bookmarks.js
Example
Marked.bookmarks.show();

toggle()

Toggle expand/shrink bookmarks

Source:
bookmarks.js
Example
Marked.bookmarks.toggle()

update()

Update bookmark display

Source:
bookmarks.js
Example
Marked.bookmarks.update();

updateMap()

Force refresh the minimap

Source:
bookmarks.js
Example
Marked.bookmarks.updateMap();