General document functions
Properties:
Name | Type | Description |
---|---|---|
headers |
array | Array of header elements in document |
dimensions |
object | visible document height and width, taking into account the CriticMarkup and Search bars. |
Methods
allHeaders() → {Array}
Return an array of all headers in the document
Returns:
Array of h1-h6 header DOM elements
- Type
- Array
Example
Marked.document.allHeaders()
countHeaders(level) → {number}
Counts the number of headers.
Parameters:
Name | Type | Description |
---|---|---|
level |
string | array | Header level(s) to check |
Returns:
Number of headers.
- Type
- number
Example
Marked.document.countHeaders()
headerSubset(a, b) → {Array}
Retrieve a subset of headers wihin a range
Parameters:
Name | Type | Description |
---|---|---|
a |
number | top limit [1-6] |
b |
number | bottom limit [1-6] |
Returns:
Array of headers within the given range (in document order)
- Type
- Array
Examples
Marked.document.headerSubset(1,3);
Marked.document.headerSubset()
highestHeaders() → {array}
Return an array consisting of the 2 highest header levels in the document
Returns:
Array of header elements
- Type
- array
Example
Marked.document.highestHeaders()
(static) dimLinks(flagopt)
Toggle removal of link highlight styles
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
flag |
boolean |
<optional> |
Force link highlights on or off (true or false), empty toggles state |
Example
Marked.document.dimLinks(true);
nearestVisibleHeadline(el) → {jQuery}
If the specified jQuery object isn't visible, find the first preceding headline element that is
Parameters:
Name | Type | Description |
---|---|---|
el |
jQuery | jQuery element to test |
Returns:
Either the original element or first visible preceding headline
- Type
- jQuery
Example
Marked.document.nearestVisibleHeadline()
toggleComments(flagopt)
Toggle all comment visibility
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
flag |
boolean |
<optional> |
Force comments on or off (true or false), empty toggles state |
Example
Marked.document.toggleComments(true);
toggleCriticComments(flagopt)
Toggle CriticMarkup comment visibility
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
flag |
boolean |
<optional> |
Force CriticMarkup comments on or off (true or false), empty toggles state |
Example
Marked.document.toggleCriticComments(true);
toggleFountainComments(flagopt)
Toggle Fountain comment visibility
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
flag |
boolean |
<optional> |
Force Fountain comments on or off (true or false), empty toggles state |
Example
Marked.document.toggleFountainComments(true);
toggleScrivenerComments(flagopt)
Toggle Scrivener comment visibility
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
flag |
boolean |
<optional> |
Force Scrivener comments on or off (true or false), empty toggles state |
Example
Marked.document.toggleScrivenerComments(true)
updateHeaderIds()
Update h1-h6 with compatible identifiers
updateWindowDimensions()
Store visible document height and width, taking into account the CriticMarkup and Search bars. Properties are stored in Marked.document.dimensions
Example
Marked.document.updateWindowDimensions()