HTML Context
This package allows you to generate some HTML context for a given DOM node. E.g. Some markup looking like this:
Hello world
with
const div = windowdocument; ;
would result in
<div id="x">…</div>
The context can either be document
or an HTMLElement
.
Install
npm install html-context --save
or in the browser (UMD):
Options
options.maxLength
: the maximum length of the returned context. The package will try and fit the outermost tag in if it can. Defaults to no maximum length.
options.beautify
: Beautifies the returned context snippet. Defaults to false
.
options.placeholder
: The placeholder to use for capped markup. Defaults to …
.