import { existsSync, readFileSync } from "node:fs"; import GithubSlugger from "github-slugger"; import { extname } from "pathe"; import { withBasePath } from "../base-path.ts"; import { diagnosticsFromIssues, diagnosticsFromZod } from "../diagnostics.ts"; import { localePlacement, localizeRoute } from "../i18n.ts"; import { pageMetaSchema } from "../schema.ts"; import type { FrontmatterExtend, PageMeta } from "../schema.ts"; import type { Diagnostic, Heading, PageLink, PageRecord } from "../types.ts"; import { detectVersionRef, versionizeRoute } from "../versions.ts"; import type { NormalizeContext, SourceEntry } from "./types.ts"; const NUMERIC_PREFIX = /^\d+[-_.]/u; const GROUP_FOLDER = /^\((?