Skip to content

Latest commit

 

History

History
85 lines (66 loc) · 4.43 KB

README.md

File metadata and controls

85 lines (66 loc) · 4.43 KB

@homeostate/docs

The landing page and docs site. Every page is prerendered from markdown, and every page also has a plain-markdown twin at the same URL plus .md, for LLMs and agents:

  • /docs/core/introduction renders packages/core/docs/introduction.md
  • /docs/core/introduction.md serves the same file as text
  • /llms.txt indexes every page; /llms-full.txt has all of them in one file, and each package has its own under /docs/<package>/
pnpm docs                              # dev server on http://localhost:5190
pnpm --filter @homeostate/docs build   # static site in apps/docs/build/client
pnpm --filter @homeostate/docs preview # serve the build with Cloudflare's local emulator

Where pages live

File URL
packages/<name>/docs/*.md /docs/<name>/<file>; introduction.md is required
packages/<name>/CHANGELOG.md /docs/<name>/changelog, generated by Changesets
apps/docs/content/*.md /docs/<file>, for guides that span packages

A public package appears on the site once it has docs/introduction.md. Private workspace packages are excluded from the catalog. Package folders are flat; images go in docs/assets/. The sidebar label and order of each package, and the role its introduction's page title names ("Yjs CRDT backend"), are in src/site.config.ts, as is each CRDT backend's one-line trade-off on the landing page; keep those in step with the package's docs.

Page format

---
description: One sentence, at most 160 characters, for search results and llms.txt.
order: 2
---

# Page title

Body…
  • The H1 on the first line is the title. It is the only H1.
  • description is required. label (a shorter sidebar label), order and draft: true are optional; drafts show in dev and are left out of production builds.
  • Link to files, not URLs: ./connecting.md#options, ../../crdt-yjs/docs/introduction.md, ../src/index.ts. Those links work on GitHub and in node_modules, and the build turns them into site paths, absolute .md URLs in the markdown twins, or GitHub links for source files. Package pages link to guides by site path: /docs/getting-started.

Conventions

Everything stays plain GitHub markdown, so the .md twin is exactly what you wrote. The site renders these more richly:

Write The site renders
> [!NOTE], [!TIP], [!IMPORTANT], [!WARNING], [!CAUTION] A callout
```ts title="store.ts" {2,4-6} A titled block with highlighted lines
```bash install holding one npm install … line npm / pnpm / yarn / bun tabs
Consecutive fences with tab="Zustand", tab="Redux" One tabbed code group
```diff Added and removed lines highlighted

Fence languages: ts, tsx, js, jsx, json, bash, sh, diff, yaml, md, text.

pnpm test checks every page and fails on a broken link or anchor, bad frontmatter, a second H1, raw HTML, an unknown fence language or meta, or shiki's // [!code …] comments (they would show up in the .md).

The getting-started guide's src/counter.ts and src/App.tsx snippets are also checked against the executable fixtures in apps/playground-react/src/__tests__/fixtures/quickstart/. Update both together: CI typechecks the fixtures and tests the counter UI, two-peer synchronization, and a new peer joining an existing room.

How it works

React Router in framework mode with ssr: false: src/routes.ts registers a static route for every page and every .md twin from the content manifest, so prerender: true renders the whole site. Loaders run only at build time. They parse and highlight the markdown (src/content), and the page ships as hast that the client renders with shadcn components, so remark and shiki never reach the browser. scripts/postbuild.ts then adapts the output for Cloudflare Pages (x/index.html to x.html, 404.html, _headers, _redirects) and checks it.