html-to-anything
Dead simple rule/callback based html traverser that can output unicorns.
Example usage
const hta = const rules = rules const html = '<p><a href="/derp">link</a> unicorns </p>'const dom = hta rules
NOTE: the '?'
in '<p>?'
is a placeholder for html text.
You can replace it by any text - it won't be matched as of now.
Regular expressions are strong contenders for next addition.
It'd be a breaking change, so we'd naturally bump the major version number, no worries.
Example output
err: '(root) misses rule for (p)' element: raw: 'p' data: 'p' type: 'tag' name: 'p' children: Object Object err: '(root.p) misses rule for (a)' element: raw: 'a href="/derp"' data: 'a href="/derp"' type: 'tag' name: 'a' attribs: href: '/derp' children: Object enter linkexit linkenter unicornsexit unicorns
API
RuleSet
xml-writer utilities
The package is not listed as a dependency, so you will have to install it manually.