Skip to content

Commit d099900

Browse files
📝 docs: restore original home modules
1 parent efa6d9b commit d099900

7 files changed

Lines changed: 209 additions & 263 deletions

File tree

‎docs/home/ApiSection.tsx‎

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
import { Streamdown } from "@lobehub/streamdown";
2+
import { Block, Typography } from "@lobehub/ui";
3+
import { useMemo } from "react";
4+
import remarkGfm from "remark-gfm";
5+
6+
import { markdownComponents } from "../../src/Streamdown/demos/shared/markdownComponents";
7+
8+
// The original site's API card (f3ba7b3:site/src/lib/samples.ts `apiReference`), updated to the
9+
// current StreamdownProps in src/Streamdown.tsx (adds `remend`).
10+
const API_REFERENCE = `| Prop | Type | Default | Description |
11+
| --- | --- | --- | --- |
12+
| \`content\` | \`string\` | — | The (partial) markdown to render |
13+
| \`smoothing\` | \`'realtime' \\| 'balanced' \\| 'silky'\` | \`'balanced'\` | Reveal pacing preset |
14+
| \`granularity\` | \`'char' \\| 'word'\` | \`'char'\` | Fade animation unit |
15+
| \`latexGuard\` | \`boolean\` | \`false\` | Hold last frame while trailing formula is incomplete |
16+
| \`preprocess\` | \`(text: string) => string\` | — | Transform content before rendering |
17+
| \`remend\` | \`RemendOptions\` | — | Options for the remend pass on the open tail block |
18+
| \`components\` / \`remarkPlugins\` / \`rehypePlugins\` | — | — | Passed through to react-markdown |
19+
20+
Lower-level hooks — \`useSmoothStreamContent\`, \`useStreamQueue\`,
21+
\`rehypeStreamAnimated\` and the LaTeX preprocessing helpers — are exported for
22+
custom pipelines. Profiling lives in \`@lobehub/streamdown/profiler\`.
23+
24+
### Limitation: cross-block references
25+
26+
Each top-level block is parsed independently, so a reference whose target sits in
27+
another block stays literal: GFM footnotes, reference-style links
28+
(\`[text][ref]\`) and reference-style images. Inline forms are unaffected. Supply
29+
a remark/rehype plugin pair if you need to resolve these out of band.
30+
`;
31+
32+
export const ApiSection = () => {
33+
const remarkPlugins = useMemo(() => [remarkGfm], []);
34+
35+
return (
36+
<Block padding={24} variant={"outlined"} width={"100%"}>
37+
<Typography fontSize={14}>
38+
<Streamdown
39+
components={markdownComponents}
40+
content={API_REFERENCE}
41+
remarkPlugins={remarkPlugins}
42+
/>
43+
</Typography>
44+
</Block>
45+
);
46+
};

‎docs/home/CodeShowcase.tsx‎

Lines changed: 0 additions & 30 deletions
This file was deleted.

‎docs/home/FeatureSection.tsx‎

Lines changed: 0 additions & 60 deletions
This file was deleted.

‎docs/home/Features.tsx‎

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import { FeatureGrid, type FeatureGridItem } from "@lobehub/ui/awesome";
2+
import { Activity, Rows2, Scan, Shield } from "lucide-react";
3+
4+
// Copy from the original site (f3ba7b3:site/src/sections/Features.tsx).
5+
const FEATURES: FeatureGridItem[] = [
6+
{
7+
description: "Character or word granularity with three cadence presets.",
8+
icon: Activity,
9+
title: "Smooth reveal",
10+
},
11+
{
12+
description: "Finished blocks memoize. Only the tail block re-renders.",
13+
icon: Rows2,
14+
title: "Block cache",
15+
},
16+
{
17+
description:
18+
"Unbalanced delimiters stay inert until the stream closes them.",
19+
icon: Shield,
20+
title: "LaTeX guard",
21+
},
22+
{
23+
description:
24+
"No stylesheet, no component dependencies. Bring your own CSS.",
25+
icon: Scan,
26+
title: "Headless",
27+
},
28+
];
29+
30+
export const Features = () => <FeatureGrid columns={4} items={FEATURES} />;

‎docs/home/HeroDemo.tsx‎

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import "katex/dist/katex.min.css";
2+
3+
import { Text } from "@lobehub/ui";
4+
import { useMemo } from "react";
5+
import rehypeKatex from "rehype-katex";
6+
import remarkGfm from "remark-gfm";
7+
import remarkMath from "remark-math";
8+
9+
import { heroSample } from "../../src/Streamdown/demos/shared/samples";
10+
import { StreamPane } from "../../src/Streamdown/demos/shared/StreamPane";
11+
import { useLocalStream } from "../../src/Streamdown/demos/shared/useLocalStream";
12+
13+
/** The original hero demo: heroSample streamed once, 6 characters every ~24ms. */
14+
export const HeroDemo = () => {
15+
const { restart, text } = useLocalStream(heroSample, {
16+
chunkSize: 6,
17+
delayMs: 24,
18+
});
19+
const remarkPlugins = useMemo(() => [remarkGfm, remarkMath], []);
20+
const rehypePlugins = useMemo(() => [rehypeKatex], []);
21+
22+
return (
23+
<StreamPane
24+
latexGuard
25+
content={text}
26+
height={300}
27+
rehypePlugins={rehypePlugins}
28+
remarkPlugins={remarkPlugins}
29+
title={"heroSample.md"}
30+
extra={
31+
<Text fontSize={12} type={"secondary"}>
32+
● streaming
33+
</Text>
34+
}
35+
onReplay={restart}
36+
/>
37+
);
38+
};

‎docs/home/demos.tsx‎

Lines changed: 0 additions & 69 deletions
This file was deleted.

0 commit comments

Comments
 (0)