Namespace: document

Marked. document

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.

Source:
document.js

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
Examples
Marked.document.countHeaders('2')
Marked.document.countHeaders([4,5])

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);

getBase()

Gets the base url

Source:
document.js
Returns:

The base url.

Type
String
Example
Marked.document.getBase()

getHTML()

Gets the live html from the DOM

Source:
document.js
Returns:

The live html.

Type
string
Example
Marked.document.getHTML()

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()

highlightAvoidWords(bool, wordArray, options)

Highlight avoid words

Parameters:
Name Type Description
bool Boolean

The bool

wordArray Array

The word array

options Object

The options

Source:
document.js
Example
Marked.document.highlightAvoidWords(true)

highlightErrors(bool)

Highlight errors

Parameters:
Name Type Description
bool boolean

show (true) or hide (false)

Source:
document.js
Returns:

result

Type
boolean
Example
Marked.document.highlightErrors(true)

init()

Initialize document and store headers array and inital window dimensions

Source:
document.js

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($el)

scrollToDiff()

Scroll to diff marker

Source:
document.js
Example
Marked.document.scrollToDiff()

setBase( [url])

Sets the URL

Parameters:
Name Type Argument Description
url string <optional>

The new url

Source:
document.js
Returns:

final url

Type
string
Example
Marked.document.setBase('https://marked2app.com')

showComments()

Hide or show comments based on configuration setting

Source:
document.js
Example
Marked.document.showComments(true);

showElementWithId(id, hide)

Shows the element with identifier.

Parameters:
Name Type Description
id string

The identifier

hide boolean

hide (false) or show (true)

Source:
document.js
Example
Marked.document.showElementWithId('firstdiff', false)

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)

unhighlightAvoid( [hltype])

Unhighlight avoid words

Parameters:
Name Type Argument Description
hltype String <optional>

The highlight type to unhighlight

Source:
document.js
Example
Marked.document.unhighlightAvoid('mkavoid')

updateHeaderIds()

Update h1-h6 with compatible identifiers

Source:
document.js
Example
Marked.document.updateHeaderIds()

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()