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