Namespace: spellcheck

Marked.spellcheck

Spelling/Grammar check properties and methods

Properties:
Name Type Description
spellData object

spellcheck results

showing boolean

whether spellcheck results are showing

showingGrammar boolean

whether grammar results are showing

checked boolean

Whether spellcheck has been completed for current document

Requires

Methods

checkDocument(options) → {boolean}

Spell/Grammar check current document

Parameters:
Name Type Description
options object

Object containing {boolean} lazy, {function} onResults, {function} onComplete

Returns:

result of document check

Type
boolean

init() → {boolean}

Initialize spell checking. Checks for cached results, runs spellcheck, turns on spelling and grammar display if enabled.

Returns:

success

Type
boolean

render(id)

Build spelling result panel for error at index

Parameters:
Name Type Description
id number

Index of element in errorElements array

report() → {object}

Build a report panel. Currently not implemented

Returns:

jQuery element containing report summary

Type
object

reveal(id)

Show panel for error at index

Parameters:
Name Type Description
id number

Index of error in errorElements

show(typeopt, hideopt)

Show/hide spelling, grammar, or both

Parameters:
Name Type Attributes Default Description
type string <optional>
both

"spell", "grammar", or "both"

hide boolean <optional>
false

Hide results (true) or show (false)

summary(resetopt) → {object}

Build spelling summary showing counts for spelling, grammar, and total issues

Parameters:
Name Type Attributes Default Description
reset boolean <optional>
false

If true, reset the current summary and rebuild

Returns:

Object containing error counts, html string, and text string

Type
object

toggle(spellingopt, grammaropt)

Toggle visibility of spelling and grammar results

Parameters:
Name Type Attributes Description
spelling boolean <optional>

force spelling results to show (true)/hide (false)

grammar boolean <optional>

force grammar results to show (true)/hide (false)

togglePanel(id)

Toggle display of panel for error at index

Parameters:
Name Type Description
id number

Index of error in errorElements