Skip to content

Commit 4fe09ae

Browse files
authored
docs: add llms copy button (#1146)
1 parent 5872a14 commit 4fe09ae

File tree

1 file changed

+29
-1
lines changed

1 file changed

+29
-1
lines changed

website/theme/index.tsx

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
import { Layout as BaseLayout } from '@rspress/core/theme';
1+
import {
2+
getCustomMDXComponent as BaseGetCustomMDXComponent,
3+
Layout as BaseLayout,
4+
} from '@rspress/core/theme';
25
import {
36
Search as PluginAlgoliaSearch,
47
ZH_LOCALES,
@@ -7,6 +10,31 @@ import { NavIcon } from '@rstack-dev/doc-ui/nav-icon';
710
import { HomeLayout } from './pages';
811
import './index.scss';
912
import { useLang } from '@rspress/core/runtime';
13+
import {
14+
LlmsContainer,
15+
LlmsCopyButton,
16+
LlmsViewOptions,
17+
} from '@rspress/plugin-llms/runtime';
18+
19+
export function getCustomMDXComponent() {
20+
const { h1: H1, ...mdxComponents } = BaseGetCustomMDXComponent();
21+
22+
const MyH1 = ({ ...props }) => {
23+
return (
24+
<>
25+
<H1 {...props} />
26+
<LlmsContainer>
27+
<LlmsCopyButton />
28+
<LlmsViewOptions />
29+
</LlmsContainer>
30+
</>
31+
);
32+
};
33+
return {
34+
...mdxComponents,
35+
h1: MyH1,
36+
};
37+
}
1038

1139
const Layout = () => {
1240
return <BaseLayout beforeNavTitle={<NavIcon />} />;

0 commit comments

Comments
 (0)