Skip to content

Commit 16f72aa

Browse files
committed
feat(docs): add full documentation generation and update guide links to include .md extension
1 parent d335a33 commit 16f72aa

2 files changed

Lines changed: 48 additions & 6 deletions

File tree

docs/.vitepress/config.ts

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
11
import { defineConfig } from "vitepress";
2+
import fs from "node:fs";
3+
import path from "node:path";
4+
5+
const SITE_URL = "https://976520.github.io/scrolloop";
6+
7+
function stripFrontmatter(content: string): string {
8+
return content.replace(/^---\r?\n[\s\S]*?\r?\n---\r?\n/, "");
9+
}
210

311
export default defineConfig({
412
title: "scrolloop",
@@ -8,6 +16,39 @@ export default defineConfig({
816

917
base: "/scrolloop/",
1018

19+
async buildEnd(siteConfig) {
20+
const { srcDir, outDir, pages } = siteConfig;
21+
22+
const fullParts: string[] = [];
23+
24+
for (const page of pages) {
25+
if (!page.startsWith("guide/")) continue;
26+
27+
const srcPath = path.join(srcDir, page);
28+
if (!fs.existsSync(srcPath)) continue;
29+
30+
const raw = fs.readFileSync(srcPath, "utf-8");
31+
const body = stripFrontmatter(raw).trim();
32+
if (!body) continue;
33+
34+
const destPath = path.join(outDir, page);
35+
fs.mkdirSync(path.dirname(destPath), { recursive: true });
36+
fs.writeFileSync(destPath, raw);
37+
38+
const url = `${SITE_URL}/${page.replace(/\.md$/, "")}`;
39+
fullParts.push(`# Source: ${url}\n\n${body}`);
40+
}
41+
42+
const header =
43+
"# scrolloop — full documentation\n\n" +
44+
"> Modern virtual and infinite scrolling components for React, " +
45+
"React Native, Preact, Vue, and Svelte.\n";
46+
fs.writeFileSync(
47+
path.join(outDir, "llms-full.txt"),
48+
`${header}\n${fullParts.join("\n\n---\n\n")}\n`
49+
);
50+
},
51+
1152
head: [
1253
["link", { rel: "icon", href: "/favicon.svg" }],
1354
["meta", { name: "theme-color", content: "#7c3aed" }],

docs/public/llms.txt

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,21 @@ scrolloop is a monorepo of framework adapters built on a platform-independent vi
1414

1515
## Guide
1616

17-
- [Introduction](https://976520.github.io/scrolloop/guide/introduction): What scrolloop is, why virtual scrolling matters, and the packages available.
18-
- [Quick start](https://976520.github.io/scrolloop/guide/quick-start): Build a windowing list in about a minute with a minimal React example.
19-
- [Concepts](https://976520.github.io/scrolloop/guide/concepts): How windowing, overscan, and absolute positioning let scrolloop render tens of thousands of items without performance loss.
17+
- [Introduction](https://976520.github.io/scrolloop/guide/introduction.md): What scrolloop is, why virtual scrolling matters, and the packages available.
18+
- [Quick start](https://976520.github.io/scrolloop/guide/quick-start.md): Build a windowing list in about a minute with a minimal React example.
19+
- [Concepts](https://976520.github.io/scrolloop/guide/concepts.md): How windowing, overscan, and absolute positioning let scrolloop render tens of thousands of items without performance loss.
2020

2121
## Components
2222

23-
- [VirtualList](https://976520.github.io/scrolloop/guide/virtual-list): The core high-performance list component, with per-runtime usage and props (`count`, `itemSize`, `height`, `renderItem`).
24-
- [InfiniteList](https://976520.github.io/scrolloop/guide/infinite-list): Combines data fetching with virtualization for page-based infinite scrolling (`fetchPage`, `pageSize`, `itemSize`, `renderItem`).
23+
- [VirtualList](https://976520.github.io/scrolloop/guide/virtual-list.md): The core high-performance list component, with per-runtime usage and props (`count`, `itemSize`, `height`, `renderItem`).
24+
- [InfiniteList](https://976520.github.io/scrolloop/guide/infinite-list.md): Combines data fetching with virtualization for page-based infinite scrolling (`fetchPage`, `pageSize`, `itemSize`, `renderItem`).
2525

2626
## Advanced
2727

28-
- [SSR Guide](https://976520.github.io/scrolloop/guide/ssr): Server-side rendering support for `@scrolloop/react`'s `InfiniteList`, using `isServerSide` and initial data to improve initial load and SEO (React DOM adapter only).
28+
- [SSR Guide](https://976520.github.io/scrolloop/guide/ssr.md): Server-side rendering support for `@scrolloop/react`'s `InfiniteList`, using `isServerSide` and initial data to improve initial load and SEO (React DOM adapter only).
2929

3030
## Optional
3131

32+
- [Full documentation](https://976520.github.io/scrolloop/llms-full.txt): Every guide page concatenated into a single markdown file.
3233
- [GitHub repository](https://github.com/976520/scrolloop): Source code, issues, and contribution workflow.
3334
- [README](https://github.com/976520/scrolloop#readme): Installation commands for each framework package.

0 commit comments

Comments
 (0)