hext.js
v1.0.9
Published
Use Hext in a browser or with node
Downloads
59
Maintainers
Readme
Hext.js — Use Hext in a browser or with Node
Hext is a domain-specific language for extracting structured data from HTML. It can be thought of as a counterpart to templates, which are typically used by web developers to structure content on the web.
Note: This package is a JavaScript/WebAssembly port of Hext. Hext is also available as a native node addon: npm install hext
See hext.thomastrapp.com for more.
Using Hext.js with Node
See hext.thomastrapp.com/download#hext-for-javascript.
const loadHext = require('hext.js');
loadHext().then(hext => {
const html = new hext.Html("<ul><li>Hello</li><li>World</li></ul>");
const rule = new hext.Rule("<li @text:my_text />");
const result = rule.extract(html).map(x => x.my_text).join(", ");
console.log(result); // "Hello, World"
});
License
Hext is released under the terms of the Apache License v2.0. The source code is hosted on Github. This binary package includes content authored by third parties:
- gumbo-parser. Copyright 2010 Google Inc. See gumbo.license.