mirror of
https://github.com/bitbaum/orangecat.git
synced 2026-12-04 06:35:56 +01:00
* feat(longform): one pipeline — bip-kit typed blocks render both the blog and community articles
OrangeCat had two long-form stacks: /blog/[slug] compiled content/blog/*.mdx
through @next/mdx with a bespoke component map, and /articles/[slug] rendered
DB markdown through react-markdown + remark-gfm + rehype-sanitize in a ~90-line
ArticleMarkdown. Both now parse through bip-kit v0.2.1's typed-block parser and
render through its reference renderer (ArticleBody), themed onto the semantic
token tier via a route-scoped --bp-* mapping (src/lib/longform/longform.css).
- src/lib/longform/ is the ONE pipeline: normalize (bullet aliases, h1→h2,
flatten nested items) + parse (blocks, TOC, reading time), server renderer
(LongformBody: shiki via setHighlighterLoader, MermaidBlock override), and
the composer's client preview (LongformPreviewBody — same blocks, honest
no-shiki fallback).
- The 10 blog .mdx files become plain .md; the only body edit is dropping the
first-line `# title` that duplicated the frontmatter title the page header
already renders (word-level parity verified for all 10 files and all 9 live
DB articles — zero content loss).
- Typed blocks are the security model for user-authored article bodies: no
HTML passthrough exists, so rehype-sanitize is unnecessary by construction.
Deleted: ArticleMarkdown.tsx, the MDX component map (incl. the unused Alert/
SecurityFeature components — no content ever referenced them), the bespoke
ReadingProgress (bip-kit's island replaces it).
- New on BOTH surfaces: sticky scroll-spy TOC, heading anchors, server-side
shiki dual-theme highlighting, figures/galleries with Lightbox, GitHub
callouts, mermaid diagrams, pull quotes, footnotes, video embeds.
- Deps: + bip-kit@^0.2.1 (minimumReleaseAgeExclude: ours, inside the window),
shiki, mermaid; − @next/mdx, @mdx-js/*, next-mdx-remote, react-markdown,
remark, remark-gfm, rehype-sanitize.
- next.config.js: withMDX gone; `turbopack: {}` acknowledges Turbopack (Next
16 makes a webpack-only config a FATAL build error once @next/mdx no longer
supplies the turbopack key — the failure mode is an opaque WorkerError).
- deploy-selfhost.sh links standalone node_modules/shiki from the traced
.pnpm store entry (FleetCrown #513 trap: tracing copies the store files but
never the top-level symlink; without it prod silently loses highlighting).
- check:mdx → check:content: the verify gate now parses every content/**/*.md
with the same bip-kit pipeline the site renders with, and refuses stray
.mdx files.
Verified: SELF_HOST=1 standalone build green; standalone smoke shows
bp-article/bp-toc/bp-progress + bp-codeblock-highlighted with dual-theme
--shiki-light/--shiki-dark spans; full 21-check verify green (2704 unit tests).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WqKqMnHQHSmkGFfc5t7Rxn
* fix(longform): delete the root mdx-components.tsx — dead with the MDX pipeline
Next.js only consults this file through @next/mdx, which is gone; with
@types/mdx removed it fails tsc in CI's clean-room worktree (locally a stale
virtual-store copy of mdx/types still resolved, hiding it).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WqKqMnHQHSmkGFfc5t7Rxn
* chore(sizes): drop the blog page's stale size exception — the ratchet tightens
The bip-kit migration deleted the ~100-line inline MDX component map, putting
/blog/[slug]/page.tsx back under its limit.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WqKqMnHQHSmkGFfc5t7Rxn
* chore(type-scale): baseline 13 → 12 — the bip-kit migration removed an arbitrary font size
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WqKqMnHQHSmkGFfc5t7Rxn
---------
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
53 lines
1.7 KiB
JavaScript
53 lines
1.7 KiB
JavaScript
#!/usr/bin/env node
|
|
// Parses every content/**/*.md with the SAME pipeline the site renders with
|
|
// (bip-kit typed blocks). A malformed chart/stats fence THROWS at parse time
|
|
// by design — this gate fails the PR instead of the standalone build on main
|
|
// (the successor to check-mdx.mjs, which guarded the retired MDX compiler
|
|
// after the 2026-08-13 red-main incident). Also refuses stray .mdx files:
|
|
// the MDX pipeline is gone, and an .mdx file would silently never render.
|
|
import { readFileSync, readdirSync, statSync } from 'node:fs';
|
|
import { join } from 'node:path';
|
|
import { parseFrontmatter, parseContentBlocks } from 'bip-kit';
|
|
|
|
function contentFiles(dir, ext) {
|
|
return readdirSync(dir).flatMap(name => {
|
|
const p = join(dir, name);
|
|
if (statSync(p).isDirectory()) {
|
|
return contentFiles(p, ext);
|
|
}
|
|
return name.endsWith(ext) ? [p] : [];
|
|
});
|
|
}
|
|
|
|
const stray = contentFiles('content', '.mdx');
|
|
if (stray.length > 0) {
|
|
console.error(`✗ .mdx files found — the MDX pipeline is retired; convert to .md:`);
|
|
for (const f of stray) {
|
|
console.error(` ${f}`);
|
|
}
|
|
process.exit(1);
|
|
}
|
|
|
|
const files = contentFiles('content', '.md');
|
|
let failed = 0;
|
|
for (const file of files) {
|
|
try {
|
|
const { meta, body } = parseFrontmatter(readFileSync(file, 'utf8'));
|
|
if (!meta.title) {
|
|
throw new Error('missing title frontmatter');
|
|
}
|
|
const blocks = parseContentBlocks(body);
|
|
if (blocks.length === 0) {
|
|
throw new Error('body parsed to zero blocks');
|
|
}
|
|
} catch (e) {
|
|
failed++;
|
|
console.error(`✗ ${file}: ${e.message}`);
|
|
}
|
|
}
|
|
if (failed) {
|
|
console.error(`${failed}/${files.length} content file(s) fail to parse`);
|
|
process.exit(1);
|
|
}
|
|
console.log(`✓ ${files.length} content files parse clean through bip-kit`);
|