Liam Dyer
Web Search: Playwright, spatial parsing, markdown (#1094)
2c00ea8 unverified
raw
history blame contribute delete
228 Bytes
import type { MarkdownElement } from "../markdown/types";
export function flattenTree(elem: MarkdownElement): MarkdownElement[] {
if ("children" in elem) return [elem, ...elem.children.flatMap(flattenTree)];
return [elem];
}