Two fixes from fleetcrown's adoption of the v0.2 renderer:
- MermaidBlock: resolved CSS-var colors are normalized through a canvas
round-trip before reaching mermaid, whose color parser rejects
oklch()/lab() — it threw inside initialize(), BEFORE render()'s .catch(),
blanking every diagram for consumers with modern-color tokens. An
initialize() failure now costs the reader the theme, never the diagram.
Theme detection is tolerant: data-theme attr wins, then a light/dark
class (next-themes attribute="class", Tailwind .dark), then the OS —
re-rendering live on all three signals.
- Optional-peer loading is now traceable: setHighlighterLoader(() =>
import("shiki")) (or a `highlighter` prop on ArticleBody/CodeBlock) puts
the literal specifier in consumer code, so bundlers resolve it and
Next.js output tracing copies shiki into output:"standalone" deploys.
The Function-hidden import stays as the zero-config fallback — a bare
import("shiki") inside bip-kit breaks every no-shiki consumer build
(verified empirically against turbopack, Next 16.3.4: "Module not found:
Can't resolve 'shiki'"). Both paths verified with real consumer builds,
with and without shiki, turbopack and webpack; the traced standalone
output contains shiki and the prerendered page carries --shiki vars.
Claude-Session: https://claude.ai/code/session_01WqKqMnHQHSmkGFfc5t7Rxn
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
One vocabulary + one reference renderer so every fleet site reads long-form
at the same standard, while typography tokens stay per-site.
Parser (root export, still zero-dep; the v0.1 ten block types unchanged):
- Inline model: parseInline → text/strong/em/code/link/footnoteRef spans;
every text-bearing block keeps `text` and gains additive `spans`.
- New blocks: h4, hr, figure (caption title), gallery (adjacent images
merge), callout (GitHub > [!NOTE] syntax, nestable), pullquote (>> with
— cite), mermaid, chart (tiny declarative spec; malformed specs THROW),
math ($$), footnote defs, stats fence.
- Headings gain slugified, de-duplicated, umlaut-aware ids (kivvi's scheme).
- parseFrontmatter learns YAML arrays (inline + block lists), still dep-free.
- Helpers: extractToc, readingTime, slugify/createSlugger, parseChartSpec.
Renderer (new bip-kit/react subpath + bip-kit/styles.css):
- ArticleBody: async RSC that pre-awaits shiki/katex, then emits a fully
synchronous tree (renderToString-safe). Server components for every block;
client islands: Toc (scroll-spy, hidden under 3 headings), ReadingProgress,
Lightbox, CopyButton. MermaidBlock on its own bip-kit/react/mermaid subpath
so the mermaid peer never enters uninterested bundles (components override).
- shiki/katex are optional peers loaded via bundler-invisible dynamic import;
honest degradation without them (mono <pre>, TeX source with data-math).
- styles.css: complete neutral theme — 70ch measure, real vertical rhythm,
dark mode via vars only (data-theme wins over prefers-color-scheme),
mobile-first, print-safe; every color/radius/font is a --bp-* custom
property (theming contract documented in the README).
CI: ci.yml gains workflow_dispatch (re-arm strand — a GITHUB_TOKEN merge
cannot trigger workflows on its own; threadkit#28 pattern).
96 tests: v0.1 compat goldens (original shapes byte-identical after
stripping additive fields), goldens for every new syntax form and edge case,
renderToString smoke tests for every block type with and without the
optional peers (BIPKIT_DISABLE_PEERS seam), consumer-install pack test now
probing ./react, ./react/mermaid and ./styles.css.
Claude-Session: https://claude.ai/code/session_01WqKqMnHQHSmkGFfc5t7Rxn
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>