docs: add companies frontmatter, schema, and rendering in badges & appendix pages

This commit is contained in:
Prad Nukala committed 2026-10-14 15:52:02 -04:00
1 parent c753937852
commit f6c580b14b
109 files changed
+1218 -12

No files matched your search

+20 -6
View File
@@ -2,6 +2,7 @@ import { defineConfig } from "blume";
import type { StandardSchema } from "blume/core/standard-schema.ts";
import { filesystem } from "blume/sources";
import { APPENDIX } from "./appendix";
import { RECENCY, type Company } from "./companies";
import redirects from "./redirects";
// Blume's defaults (`inter`, `ibm-plex-mono`) are fetched from fonts.gstatic.com
@@ -33,13 +34,14 @@ const plexMono = {
};
/**
* Custom frontmatter, rendered as the badge row by
* Custom frontmatter, rendered between the description and the body by
* components/ProblemBadges.astro. Problem pages: `topics:` is LeetCode's topic
* tags and `issue:` the problem's GitHub issue URL (both written by
* apps/cli/sync.ts), `video:` the NeetCode walkthrough's
* YouTube id (apps/cli/videos.ts). Blume rejects undeclared keys and takes
* any Standard Schema; these are hand-rolled so the docs workspace needs no
* zod. All optional — every other page carries none.
* tags, `issue:` the problem's GitHub issue URL and `companies:` the companies
* that asked it in the last six months (`companies.ts`; the table under the
* badge row) — all three written by apps/cli/sync.ts — and `video:` the
* NeetCode walkthrough's YouTube id (apps/cli/videos.ts). Blume rejects
* undeclared keys and takes any Standard Schema; these are hand-rolled so the
* docs workspace needs no zod. All optional — every other page carries none.
*/
const optional = <T>(
message: string,
@@ -74,6 +76,17 @@ const issueSchema = optional(
typeof value === "string" &&
/^https:\/\/github\.com\/[\w.-]+\/[\w.-]+\/issues\/\d+$/.test(value),
);
const companiesSchema = optional(
`expected a list of { name, period, frequency } with period one of ${RECENCY.join(" | ")}`,
(value): value is Company[] =>
Array.isArray(value) &&
value.every(
(c) =>
typeof c?.name === "string" &&
RECENCY.includes(c?.period) &&
typeof c?.frequency === "number",
),
);
export default defineConfig({
title: "prdlk",
@@ -102,6 +115,7 @@ export default defineConfig({
topics: topicsSchema,
video: videoSchema,
issue: issueSchema,
companies: companiesSchema,
},
},
seo: {