Skip to content

feat: loadCollection for any MDX folder, and a reset-free prose.css - #26

Merged
CharanMN7 merged 3 commits into
mainfrom
feat/collections-and-prose-css
Oct 21, 2026
Merged

CharanMN7 merged 3 commits into
mainfrom
feat/collections-and-prose-css

Conversation

@CharanMN7

@CharanMN7 CharanMN7 commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Two small additions for sites that use Inkform for MDX but have their own design and their own content types. These came out of the business.charan.dev rebuild, which loads podcast episodes and course notes and has its own design system.

loadCollection(dir, parse?)

In @inkform/framework/content:

  • Loads content/<dir>/*.mdx, sorted by file name. dir can be nested, e.g. podcast/episodes.
  • Skips _-prefixed files, so _example.mdx and drafts can sit next to real entries.
  • parse (optional) types and validates the frontmatter. A zod schema's .parse works.
  • When parse throws, the error starts with Invalid frontmatter in content/<dir>/<file>:, so a bad field fails the build with a pointer to it.
  • Each entry has slug, file, data, content, excerpt and readingTime.

@inkform/framework/prose.css

  • Contains tokens, prose.css, components.css and mermaid.css.
  • Leaves out the global reset and the shell styles, so it never restyles the host's html, body or bare elements. Every rule stays inside .fw-*.
  • To make that possible, the reset moved from styles/tokens.css into a new styles/base.css. styles.css imports it right after the tokens, so its output is unchanged. I diffed the flattened CSS, ignoring comments and whitespace: identical.

Dependency fix (second commit)

CI's npm audit --audit-level=high gate was failing on advisories published since main last passed (27 Sep). It would fail on main too.

  • next 16.3.6 → 16.3.8 in the templates and examples.
  • sharp override 0.35.4 → 0.35.5.
  • vitest ^3.2.4 → ^4.1.12. This clears the critical vitest and tinypool advisories.
  • New vite override at ^7.3.7. It also keeps vitest off vite 8, whose optional devtools peers crash npm 10's peer resolution.
  • @modelcontextprotocol/sdk floor raised to ^1.32.1.
  • npm audit fix for source-map-js, hono and katex.

Four moderate sprintf-js/js-yaml findings under gray-matter remain, below the gate. Fixing them needs a gray-matter downgrade.

Search index fix (third commit)

Next 16.3.8 is a security release, so the bump is required. Built with a deployment adapter, as on Vercel, it writes prerendered HTML to .next/server/route-cache/APP_PAGE/<hash>/$/<route>.html instead of .next/server/app/. The pagefind --site .next/server/app postbuild therefore found 0 files and failed the inkform-docs and pokeapi Vercel builds.

  • The three templates and three examples now run node scripts/pagefind.mjs.
  • The script reads both layouts and indexes each page under its real URL (/docs/intro, not /docs/intro.html) through Pagefind's Node API.
  • Next's _not-found and _global-error pages are skipped.
  • The existing .html redirect stays, so old links keep working.
  • The script lives in each template rather than in the framework package. The CLI scaffolds templates from GitHub main while @inkform/framework comes from npm, so a framework bin would break new scaffolds until the next release.

Test plan

  • npm ci on Node 22 / npm 10 works from the new lockfile.
  • npm run typecheck: passes across all workspaces.
  • npm test: 16 files, 110 tests pass on vitest 4, including 4 new loadCollection tests.
  • npm audit --audit-level=high: exits 0.
  • npm run build: left to CI (six Next builds).
  • Pagefind script, tested on examples/markdown-docs in two builds:
    • With a no-op adapter (NEXT_ADAPTER_PATH), which reproduces Vercel's layout: 0 HTML files in app/, the old postbuild fails the same way, and the script indexes 22 pages.
    • A plain build: the same 22 URLs.
  • prose.css flattened: no html or body rules.

No version bump. The changelog entry is under [Unreleased].

- loadCollection(dir, parse?) in ./content loads content/<dir>/*.mdx, skips _ files,
  and types/validates frontmatter through an optional parser (a zod .parse works).
  Parser errors name the file.
- ./prose.css: tokens + prose + component kit + mermaid, with no global reset, for
  host sites with their own layout. The reset moved from styles/tokens.css to
  styles/base.css; styles.css output is unchanged.
@vercel

vercel Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
framework-inkform-docs Ready Ready Preview Oct 21, 2026 11:22pm UTC
pokeapi Ready Ready Preview Oct 21, 2026 11:22pm UTC

Request Review

CI's npm audit --audit-level=high gate started failing on advisories published
after the last green main run (27 Sep):
- next 16.3.6 -> 16.3.8 in templates/examples (six advisories, <16.3.8)
- sharp override 0.35.4 -> 0.35.5 (GHSA-wq5f-xc86-pv6w)
- vitest ^3.2.4 -> ^4.1.12 (critical GHSA-82fw-gwwq-j7x9; drops tinypool, critical
  GHSA-5gmw-xhrv-c9v3 / GHSA-85c8-ppgw-ccpr)
- vite override ^7.3.7 (five advisories <=7.3.6; also keeps vitest off vite 8,
  whose optional devtools peers crash npm 10's peer resolution)
- @modelcontextprotocol/sdk ^1.29.0 -> ^1.32.1 (five advisories <1.32.0)
- source-map-js, hono and katex via npm audit fix

npm audit --audit-level=high now exits 0. Four moderate sprintf-js/js-yaml
findings under gray-matter remain (fix needs a gray-matter downgrade).
Next.js 16.3.8 built with a deployment adapter (Vercel) writes prerendered HTML
to .next/server/route-cache/APP_PAGE/<hash>/$/<route>.html instead of
.next/server/app, so the postbuild `pagefind --site .next/server/app` found no
files and failed the Vercel builds of inkform-docs and pokeapi.

Templates and examples now run scripts/pagefind.mjs, which reads both layouts
and indexes each page through Pagefind's Node API under its real URL
(/docs/intro rather than /docs/intro.html); Next's _not-found and _global-error
pages are skipped. The .html redirect stays for old links. The script lives in
each template (not in the framework package) because the CLI scaffolds templates
from GitHub main while @inkform/framework comes from npm.

This branch was successfully deployed

2 active deployments
Preview – framework-inkform-docs — 60971b4b Deployed Oct 21, 2026 by vercel[bot]
Preview – pokeapi — 60971b4b Deployed Oct 21, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant