Skip to main content
Module

x/dendron_exports/deps/unist.ts>visit

Export your Dendron vault into SSG compatible markdown
Go to Latest
variable visit
import { visit } from "https://deno.land/x/dendron_exports@v0.1.2/deps/unist.ts";

Visit nodes.

This algorithm performs depth-first tree traversal in preorder (NLR) or if reverse is given, in reverse preorder (NRL).

You can choose for which nodes visitor is called by passing a test. For complex tests, you should test yourself in visitor, as it will be faster and will have improved type information.

Walking the tree is an intensive task. Make use of the return values of the visitor when possible. Instead of walking a tree multiple times, walk it once, use unist-util-is to check if a node matches, and then perform different operations.

You can change the tree. See Visitor for more info.

type

(<Tree extends import("https://esm.sh/v126/@types/unist@2.0.6/index.d.ts").Node<import("https://esm.sh/v126/@types/unist@2.0.6/index.d.ts").Data>, Check extends import("https://esm.sh/v126/unist-util-is@5.2.1/lib/index.d.ts").Test>(
tree: Tree,
test: Check,
visitor: BuildVisitor<Tree, Check>,
reverse?: boolean | null | undefined,
) => void) & (<Tree_1 extends import("https://esm.sh/v126/@types/unist@2.0.6/index.d.ts").Node<import("https://esm.sh/v126/@types/unist@2.0.6/index.d.ts").Data>>(
tree: Tree_1,
visitor: BuildVisitor<Tree_1, string>,
reverse?: boolean | null | undefined,
) => void)