import { readFile } from "node:fs/promises"; import { lex } from "./views/engine/lexer.ts"; import { parse } from "./views/engine/parser.ts"; import { compileTemplate } from "./views/engine/compiler.ts"; const src = await readFile( "./critdotrip/muddle/modules/app/views/index.spug", "utf8", ); const tokens = lex(src); const parsed = parse(tokens); const { source } = compileTemplate(parsed.nodes, { path: "/x/index.spug", dir: "/x", frontmatter: parsed.frontmatter || "", }); const i = source.indexOf("hellings"); console.log("index", i); if (i >= 0) console.log(source.slice(Math.max(0, i - 400), i + 200));