Skip to content

Instantly share code, notes, and snippets.

@tmcw
Created July 15, 2020 04:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tmcw/a80e4b45b3d7b3cc1c6fce46b5a4aa95 to your computer and use it in GitHub Desktop.
Save tmcw/a80e4b45b3d7b3cc1c6fce46b5a4aa95 to your computer and use it in GitHub Desktop.
const got = require("got");
const selectAll = require("hast-util-select").selectAll;
const unified = require("unified");
const parse = require("rehype-parse");
(async function () {
const { body } = await got("https://macwright.com/");
const ast = await unified()
.use(parse, { emitParseErrors: true, duplicateAttribute: false })
.parse(body);
console.log(selectAll("a", ast));
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment