Add configurable error callback (#658)

Replace console.error with a configurable option. This mimcs the current
default behaviour to guaranteee compatibility with previous versions.
Update errorCallback to the README.md
This commit is contained in:
Jörn Lenoch
2017-07-30 17:27:29 +02:00
committed by Kevin Barabash
parent 2da06d541e
commit 2eb32a8775
2 changed files with 10 additions and 5 deletions

View File

@@ -83,8 +83,11 @@ in addition to two auto-render-specific keys:
- `ignoredTags`: This is a list of DOM node types to ignore when recursing
through. The default value is
`["script", "noscript", "style", "textarea", "pre", "code"]`.
`["script", "noscript", "style", "textarea", "pre", "code"]`.
- `errorCallback`: A callback method returning a message and an error stack
in case of an critical error during rendering. The default uses `console.error`.
Note that the `displayMode` property of the options object is ignored, and is
instead taken from the `display` key of the corresponding entry in the
`delimiters` key.
`delimiters` key.