/** @type {import("@johnlindquist/kit")} */// Menu: Read Random link from a mardown file// Description: Open a random link from a markdown file// Author: Horacio Herrera// Twitter: @hhg2288/** @type {typeof import("unified")} */let { unified } = await npm("unified")/** @type {typeof import("remark-parse").default} */let remarkParse = await npm("remark-parse")/** @type {typeof import("unist-util-visit")} */let { visit } = await npm("unist-util-visit")// get the markdown file you want to parselet file = home(`workspace/braindump/inbox.md`)let contents = await readFile(file, "utf-8")let tree = unified().use(remarkParse).parse(contents)// create an array of linkslet links = []visit(tree, "link", function linkVisitor(node) {links.push(node)})// open a random url from the generated listlet index = Math.floor(Math.random() * (links.length - 1))exec(`open '${links[index].url}'`)