1.0.9 • Published 14 days ago

hext.js v1.0.9

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
14 days ago

Hext.js — Use Hext in a browser or with Node

Hext Logo

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:

1.0.9

14 days ago

1.0.8

6 months ago

1.0.6

7 months ago

1.0.5

1 year ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago