@rspress/plugin-llms 2.0.0-rc.5 → 2.0.0-rc.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +4 -4
- package/dist/runtime/index.d.ts +14 -57
- package/dist/runtime/index.js +1 -360
- package/package.json +6 -7
- package/dist/rslib-runtime.js +0 -18
- package/dist/runtime/index.css +0 -168
- package/dist/runtime/index.js.LICENSE.txt +0 -5
package/dist/index.js
CHANGED
|
@@ -26,9 +26,9 @@ function generateLlmsTxt(pageDataArray, navList, others, llmsTxtOptions, title,
|
|
|
26
26
|
const title = text;
|
|
27
27
|
lines.push(`\n## ${title}\n`);
|
|
28
28
|
for (const page of pages){
|
|
29
|
-
const { routePath, lang, title,
|
|
29
|
+
const { routePath, lang, title, description } = page;
|
|
30
30
|
if ('/' === routePath || routePath === `/${lang}/`) continue;
|
|
31
|
-
const line = onLineGenerate ? onLineGenerate(page) : `- [${title}](${routePathToMdPath(routePath, base)})${
|
|
31
|
+
const line = onLineGenerate ? onLineGenerate(page) : `- [${title}](${routePathToMdPath(routePath, base)})${description ? `: ${description}` : ''}`;
|
|
32
32
|
lines.push(line);
|
|
33
33
|
}
|
|
34
34
|
}
|
|
@@ -36,9 +36,9 @@ function generateLlmsTxt(pageDataArray, navList, others, llmsTxtOptions, title,
|
|
|
36
36
|
const otherLines = [];
|
|
37
37
|
otherLines.push('\n## Other\n');
|
|
38
38
|
for (const page of others){
|
|
39
|
-
const { routePath, lang, title,
|
|
39
|
+
const { routePath, lang, title, description } = page;
|
|
40
40
|
if ('/' === routePath || routePath === `/${lang}/`) continue;
|
|
41
|
-
const line = onLineGenerate ? onLineGenerate(page) : `- [${title}](${routePathToMdPath(routePath, base)})${
|
|
41
|
+
const line = onLineGenerate ? onLineGenerate(page) : `- [${title}](${routePathToMdPath(routePath, base)})${description ? `: ${description}` : ''}`;
|
|
42
42
|
otherLines.push(line);
|
|
43
43
|
hasOthers = true;
|
|
44
44
|
}
|
package/dist/runtime/index.d.ts
CHANGED
|
@@ -1,66 +1,23 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
1
|
+
import { LlmsContainer } from '@rspress/core/theme';
|
|
2
|
+
import { LlmsContainerProps } from '@rspress/core/theme';
|
|
3
|
+
import { LlmsCopyButton } from '@rspress/core/theme';
|
|
4
|
+
import { LlmsCopyButtonProps } from '@rspress/core/theme';
|
|
5
|
+
import { LlmsViewOptions } from '@rspress/core/theme';
|
|
6
|
+
import { LlmsViewOptionsProps } from '@rspress/core/theme';
|
|
7
|
+
import { useMdUrl } from '@rspress/core/theme';
|
|
3
8
|
|
|
4
|
-
export
|
|
9
|
+
export { LlmsContainer }
|
|
5
10
|
|
|
6
|
-
export
|
|
7
|
-
}
|
|
11
|
+
export { LlmsContainerProps }
|
|
8
12
|
|
|
9
|
-
export
|
|
13
|
+
export { LlmsCopyButton }
|
|
10
14
|
|
|
11
|
-
export
|
|
12
|
-
/**
|
|
13
|
-
* Text by language, used with `useLang`.
|
|
14
|
-
* @default en: 'Copy Markdown', zh: '复制 Markdown'
|
|
15
|
-
*/
|
|
16
|
-
textByLang?: Record<string, string>;
|
|
17
|
-
/**
|
|
18
|
-
* Priority is higher than textByLang
|
|
19
|
-
* @default ''
|
|
20
|
-
*/
|
|
21
|
-
text?: string;
|
|
22
|
-
/**
|
|
23
|
-
* Overrides the default click handler.
|
|
24
|
-
* If provided, the default copy to clipboard functionality will not be executed.
|
|
25
|
-
*/
|
|
26
|
-
onClick?: React.MouseEventHandler<HTMLButtonElement>;
|
|
27
|
-
}
|
|
15
|
+
export { LlmsCopyButtonProps }
|
|
28
16
|
|
|
29
|
-
export
|
|
17
|
+
export { LlmsViewOptions }
|
|
30
18
|
|
|
31
|
-
export
|
|
32
|
-
/**
|
|
33
|
-
* Default options for the dropdown.
|
|
34
|
-
* @default ['markdownLink', 'chatgpt', 'claude']
|
|
35
|
-
* - 'chatgpt': Open in ChatGPT
|
|
36
|
-
* - 'claude': Open in Claude
|
|
37
|
-
*/
|
|
38
|
-
options?: Option_2[];
|
|
39
|
-
/**
|
|
40
|
-
* Button text by language, used with `useLang`.
|
|
41
|
-
* @default en: 'Open', zh: '打开'
|
|
42
|
-
*/
|
|
43
|
-
textByLang?: Record<string, string>;
|
|
44
|
-
/**
|
|
45
|
-
* Button text.
|
|
46
|
-
* Priority is higher than textByLang
|
|
47
|
-
* @default ''
|
|
48
|
-
*/
|
|
49
|
-
text?: string;
|
|
50
|
-
}
|
|
19
|
+
export { LlmsViewOptionsProps }
|
|
51
20
|
|
|
52
|
-
|
|
53
|
-
title: string;
|
|
54
|
-
icon?: React_2.ReactNode;
|
|
55
|
-
onClick?: () => void;
|
|
56
|
-
} | {
|
|
57
|
-
title: string;
|
|
58
|
-
href: string;
|
|
59
|
-
icon?: React_2.ReactNode;
|
|
60
|
-
} | 'markdownLink' | 'chatgpt' | 'claude';
|
|
61
|
-
|
|
62
|
-
export declare function useMdUrl(): {
|
|
63
|
-
pathname: string;
|
|
64
|
-
};
|
|
21
|
+
export { useMdUrl }
|
|
65
22
|
|
|
66
23
|
export { }
|
package/dist/runtime/index.js
CHANGED
|
@@ -1,360 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import "./index.css";
|
|
3
|
-
import "../rslib-runtime.js";
|
|
4
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
-
import { normalizeHref, useLang, usePageData, withBase } from "@rspress/core/runtime";
|
|
6
|
-
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
7
|
-
var _1 = "llmsContainer-glE3L4";
|
|
8
|
-
function LlmsContainer(props) {
|
|
9
|
-
return /*#__PURE__*/ jsx("div", {
|
|
10
|
-
...props,
|
|
11
|
-
className: `rp-not-doc ${_1}`
|
|
12
|
-
});
|
|
13
|
-
}
|
|
14
|
-
function IconCopy({ className }) {
|
|
15
|
-
return /*#__PURE__*/ jsxs("svg", {
|
|
16
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
17
|
-
width: "16",
|
|
18
|
-
height: "16",
|
|
19
|
-
viewBox: "0 0 16 16",
|
|
20
|
-
className: className,
|
|
21
|
-
fill: "none",
|
|
22
|
-
children: [
|
|
23
|
-
/*#__PURE__*/ jsx("path", {
|
|
24
|
-
d: "M4.33301 4.14386V2.60416C4.33301 2.08639 4.75274 1.66666 5.27051 1.66666H13.3955C13.9133 1.66666 14.333 2.08639 14.333 2.60416V10.7292C14.333 11.2469 13.9133 11.6667 13.3955 11.6667H11.8384",
|
|
25
|
-
stroke: "#808080",
|
|
26
|
-
strokeWidth: "1.33333",
|
|
27
|
-
strokeLinecap: "round",
|
|
28
|
-
strokeLinejoin: "round"
|
|
29
|
-
}),
|
|
30
|
-
/*#__PURE__*/ jsx("path", {
|
|
31
|
-
d: "M10.7295 4.33334H2.60449C2.08673 4.33334 1.66699 4.75308 1.66699 5.27084V13.3958C1.66699 13.9136 2.08673 14.3333 2.60449 14.3333H10.7295C11.2473 14.3333 11.667 13.9136 11.667 13.3958V5.27084C11.667 4.75308 11.2473 4.33334 10.7295 4.33334Z",
|
|
32
|
-
stroke: "#808080",
|
|
33
|
-
strokeWidth: "1.33333",
|
|
34
|
-
strokeLinejoin: "round"
|
|
35
|
-
})
|
|
36
|
-
]
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
var LlmsCopyButton_module_1 = "iconContainer-G_2NC6";
|
|
40
|
-
var _2 = "iconCopy-g1n4MZ";
|
|
41
|
-
var _3 = "iconSuccess-PId4Mj";
|
|
42
|
-
var _4 = "llmsCopyButtonContainer-osHvFn";
|
|
43
|
-
var _5 = "loading-p5nEhg";
|
|
44
|
-
var _6 = "success-F4Qj8u";
|
|
45
|
-
function routePathToMdPath(routePath) {
|
|
46
|
-
let url = routePath;
|
|
47
|
-
url = normalizeHref(url, false);
|
|
48
|
-
url = url.replace(/\.html$/, '.md');
|
|
49
|
-
return withBase(url);
|
|
50
|
-
}
|
|
51
|
-
function useMdUrl() {
|
|
52
|
-
const { page } = usePageData();
|
|
53
|
-
const mdPath = useMemo(()=>{
|
|
54
|
-
const pathname = routePathToMdPath(page.routePath);
|
|
55
|
-
return {
|
|
56
|
-
pathname
|
|
57
|
-
};
|
|
58
|
-
}, [
|
|
59
|
-
page.routePath
|
|
60
|
-
]);
|
|
61
|
-
return mdPath;
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* Inspired from fumadocs docsite
|
|
65
|
-
* @from https://github.com/fuma-nama/fumadocs/blob/5723bbe58ef805a5421a780abf235a10b251be2f/apps/docs/app/docs/%5B...slug%5D/page.client.tsx#L11
|
|
66
|
-
* @license MIT
|
|
67
|
-
*/ function IconSuccess({ className }) {
|
|
68
|
-
return /*#__PURE__*/ jsx("svg", {
|
|
69
|
-
width: "32",
|
|
70
|
-
height: "32",
|
|
71
|
-
viewBox: "0 0 30 30",
|
|
72
|
-
className: className,
|
|
73
|
-
children: /*#__PURE__*/ jsx("path", {
|
|
74
|
-
fill: "#49cd37",
|
|
75
|
-
d: "m13 24l-9-9l1.414-1.414L13 21.171L26.586 7.586L28 9L13 24z"
|
|
76
|
-
})
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
const cache = new Map();
|
|
80
|
-
function LlmsCopyButton(props) {
|
|
81
|
-
const { onClick, text, textByLang = {
|
|
82
|
-
zh: '复制 Markdown',
|
|
83
|
-
en: 'Copy Markdown'
|
|
84
|
-
}, ...otherProps } = props;
|
|
85
|
-
const lang = useLang();
|
|
86
|
-
const { pathname } = useMdUrl();
|
|
87
|
-
const [isLoading, setLoading] = useState(false);
|
|
88
|
-
const [isFinished, setFinished] = useState(false);
|
|
89
|
-
const timer = useRef(null);
|
|
90
|
-
const handleClick = useCallback(async ()=>{
|
|
91
|
-
setLoading(true);
|
|
92
|
-
const url = pathname;
|
|
93
|
-
try {
|
|
94
|
-
const content = cache.get(url) ?? await fetch(url).then((res)=>res.text());
|
|
95
|
-
cache.set(url, content);
|
|
96
|
-
await navigator.clipboard.writeText(content);
|
|
97
|
-
} finally{
|
|
98
|
-
setLoading(false);
|
|
99
|
-
setFinished(true);
|
|
100
|
-
if (timer.current) {
|
|
101
|
-
clearTimeout(timer.current);
|
|
102
|
-
timer.current = null;
|
|
103
|
-
}
|
|
104
|
-
timer.current = window.setTimeout(()=>{
|
|
105
|
-
setFinished(false);
|
|
106
|
-
timer.current = null;
|
|
107
|
-
}, 500);
|
|
108
|
-
}
|
|
109
|
-
}, [
|
|
110
|
-
pathname
|
|
111
|
-
]);
|
|
112
|
-
if (!pathname) return /*#__PURE__*/ jsx(Fragment, {});
|
|
113
|
-
return /*#__PURE__*/ jsxs("button", {
|
|
114
|
-
...otherProps,
|
|
115
|
-
disabled: isLoading,
|
|
116
|
-
className: [
|
|
117
|
-
'rp-not-doc',
|
|
118
|
-
_4,
|
|
119
|
-
isLoading ? _5 : '',
|
|
120
|
-
isFinished ? _6 : ''
|
|
121
|
-
].filter(Boolean).join(' '),
|
|
122
|
-
onClick: onClick ?? handleClick,
|
|
123
|
-
children: [
|
|
124
|
-
/*#__PURE__*/ jsxs("div", {
|
|
125
|
-
className: LlmsCopyButton_module_1,
|
|
126
|
-
children: [
|
|
127
|
-
/*#__PURE__*/ jsx(IconSuccess, {
|
|
128
|
-
className: _3
|
|
129
|
-
}),
|
|
130
|
-
/*#__PURE__*/ jsx(IconCopy, {
|
|
131
|
-
className: _2
|
|
132
|
-
})
|
|
133
|
-
]
|
|
134
|
-
}),
|
|
135
|
-
/*#__PURE__*/ jsx("span", {
|
|
136
|
-
children: text ?? textByLang?.[lang] ?? 'Copy Markdown'
|
|
137
|
-
})
|
|
138
|
-
]
|
|
139
|
-
});
|
|
140
|
-
}
|
|
141
|
-
var LlmsViewOptions_module_1 = "active-SacMuO";
|
|
142
|
-
var LlmsViewOptions_module_2 = "dropdownArrow-UjqrjW";
|
|
143
|
-
var LlmsViewOptions_module_3 = "dropdownButton-Mj4g7p";
|
|
144
|
-
var LlmsViewOptions_module_4 = "dropdownItem-taWikf";
|
|
145
|
-
var LlmsViewOptions_module_5 = "dropdownMenu-_ggfjT";
|
|
146
|
-
var LlmsViewOptions_module_6 = "externalIcon-r8tMpa";
|
|
147
|
-
var _8 = "leftIcon-JI6iFK";
|
|
148
|
-
var _9 = "rotated-YGs7Vp";
|
|
149
|
-
/**
|
|
150
|
-
* Inspired from fumadocs docsite
|
|
151
|
-
* @from https://github.com/fuma-nama/fumadocs/blob/5723bbe58ef805a5421a780abf235a10b251be2f/apps/docs/app/docs/%5B...slug%5D/page.client.tsx#L11
|
|
152
|
-
* @license MIT
|
|
153
|
-
*/ const IconArrow = ({ className })=>/*#__PURE__*/ jsx("svg", {
|
|
154
|
-
className: className,
|
|
155
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
156
|
-
width: "16",
|
|
157
|
-
height: "16",
|
|
158
|
-
viewBox: "0 0 15 16",
|
|
159
|
-
fill: "none",
|
|
160
|
-
children: /*#__PURE__*/ jsx("path", {
|
|
161
|
-
d: "M11.125 5.27885L7 9.72115L2.875 5.27885",
|
|
162
|
-
stroke: "#4E5969",
|
|
163
|
-
strokeWidth: "1.125",
|
|
164
|
-
strokeLinecap: "round",
|
|
165
|
-
strokeLinejoin: "round"
|
|
166
|
-
})
|
|
167
|
-
});
|
|
168
|
-
const IconExternalLink = ()=>/*#__PURE__*/ jsxs("svg", {
|
|
169
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
170
|
-
width: "16",
|
|
171
|
-
height: "16",
|
|
172
|
-
viewBox: "0 0 16 16",
|
|
173
|
-
fill: "none",
|
|
174
|
-
children: [
|
|
175
|
-
/*#__PURE__*/ jsx("path", {
|
|
176
|
-
d: "M9.33301 2H13.9997V6.66667",
|
|
177
|
-
stroke: "#808080",
|
|
178
|
-
strokeWidth: "1.33333",
|
|
179
|
-
strokeLinecap: "round",
|
|
180
|
-
strokeLinejoin: "round"
|
|
181
|
-
}),
|
|
182
|
-
/*#__PURE__*/ jsx("path", {
|
|
183
|
-
d: "M14 9.82457V13C14 13.5523 13.5523 14 13 14H3C2.44772 14 2 13.5523 2 13V3C2 2.44772 2.44772 2 3 2H6",
|
|
184
|
-
stroke: "#808080",
|
|
185
|
-
strokeWidth: "1.33333",
|
|
186
|
-
strokeLinecap: "round",
|
|
187
|
-
strokeLinejoin: "round"
|
|
188
|
-
}),
|
|
189
|
-
/*#__PURE__*/ jsx("path", {
|
|
190
|
-
d: "M8.59961 7.39996L13.6996 2.29996",
|
|
191
|
-
stroke: "#808080",
|
|
192
|
-
strokeWidth: "1.33333",
|
|
193
|
-
strokeLinecap: "round",
|
|
194
|
-
strokeLinejoin: "round"
|
|
195
|
-
})
|
|
196
|
-
]
|
|
197
|
-
});
|
|
198
|
-
const LlmsViewOptions = ({ options = [
|
|
199
|
-
'markdownLink',
|
|
200
|
-
'chatgpt',
|
|
201
|
-
'claude'
|
|
202
|
-
], text, textByLang = {
|
|
203
|
-
en: 'Open',
|
|
204
|
-
zh: '打开'
|
|
205
|
-
} })=>{
|
|
206
|
-
const [isOpen, setIsOpen] = useState(false);
|
|
207
|
-
const dropdownRef = useRef(null);
|
|
208
|
-
useEffect(()=>{
|
|
209
|
-
const handleClickOutside = (event)=>{
|
|
210
|
-
if (dropdownRef.current && event.target && !dropdownRef.current.contains(event.target)) setIsOpen(false);
|
|
211
|
-
};
|
|
212
|
-
document.addEventListener('mousedown', handleClickOutside);
|
|
213
|
-
return ()=>{
|
|
214
|
-
document.removeEventListener('mousedown', handleClickOutside);
|
|
215
|
-
};
|
|
216
|
-
}, []);
|
|
217
|
-
const toggleDropdown = ()=>{
|
|
218
|
-
setIsOpen(!isOpen);
|
|
219
|
-
};
|
|
220
|
-
const { pathname } = useMdUrl();
|
|
221
|
-
const lang = useLang();
|
|
222
|
-
const isEn = !lang || 'en' === lang;
|
|
223
|
-
const items = useMemo(()=>{
|
|
224
|
-
const fullMarkdownUrl = "u" > typeof window ? new URL(pathname, window.location.origin).toString() : 'loading';
|
|
225
|
-
const q = `Read ${fullMarkdownUrl}, I want to ask questions about it.`;
|
|
226
|
-
return {
|
|
227
|
-
markdownLink: {
|
|
228
|
-
title: isEn ? 'Copy Markdown link' : '复制 Markdown 链接',
|
|
229
|
-
icon: /*#__PURE__*/ jsx("svg", {
|
|
230
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
231
|
-
viewBox: "0 0 24 24",
|
|
232
|
-
width: "24",
|
|
233
|
-
height: "24",
|
|
234
|
-
children: /*#__PURE__*/ jsxs("g", {
|
|
235
|
-
fill: "none",
|
|
236
|
-
stroke: "currentColor",
|
|
237
|
-
strokeLinecap: "round",
|
|
238
|
-
strokeLinejoin: "round",
|
|
239
|
-
strokeWidth: "2",
|
|
240
|
-
children: [
|
|
241
|
-
/*#__PURE__*/ jsx("path", {
|
|
242
|
-
d: "M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"
|
|
243
|
-
}),
|
|
244
|
-
/*#__PURE__*/ jsx("path", {
|
|
245
|
-
d: "M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"
|
|
246
|
-
})
|
|
247
|
-
]
|
|
248
|
-
})
|
|
249
|
-
}),
|
|
250
|
-
onClick: ()=>{
|
|
251
|
-
navigator.clipboard.writeText(fullMarkdownUrl);
|
|
252
|
-
}
|
|
253
|
-
},
|
|
254
|
-
chatgpt: {
|
|
255
|
-
title: isEn ? 'Open in ChatGPT' : '在 ChatGPT 中打开',
|
|
256
|
-
href: `https://chatgpt.com/?${new URLSearchParams({
|
|
257
|
-
hints: 'search',
|
|
258
|
-
q
|
|
259
|
-
})}`,
|
|
260
|
-
icon: /*#__PURE__*/ jsxs("svg", {
|
|
261
|
-
role: "img",
|
|
262
|
-
viewBox: "0 0 24 24",
|
|
263
|
-
fill: "currentColor",
|
|
264
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
265
|
-
children: [
|
|
266
|
-
/*#__PURE__*/ jsx("title", {
|
|
267
|
-
children: "OpenAI"
|
|
268
|
-
}),
|
|
269
|
-
/*#__PURE__*/ jsx("path", {
|
|
270
|
-
d: "M22.2819 9.8211a5.9847 5.9847 0 0 0-.5157-4.9108 6.0462 6.0462 0 0 0-6.5098-2.9A6.0651 6.0651 0 0 0 4.9807 4.1818a5.9847 5.9847 0 0 0-3.9977 2.9 6.0462 6.0462 0 0 0 .7427 7.0966 5.98 5.98 0 0 0 .511 4.9107 6.051 6.051 0 0 0 6.5146 2.9001A5.9847 5.9847 0 0 0 13.2599 24a6.0557 6.0557 0 0 0 5.7718-4.2058 5.9894 5.9894 0 0 0 3.9977-2.9001 6.0557 6.0557 0 0 0-.7475-7.0729zm-9.022 12.6081a4.4755 4.4755 0 0 1-2.8764-1.0408l.1419-.0804 4.7783-2.7582a.7948.7948 0 0 0 .3927-.6813v-6.7369l2.02 1.1686a.071.071 0 0 1 .038.052v5.5826a4.504 4.504 0 0 1-4.4945 4.4944zm-9.6607-4.1254a4.4708 4.4708 0 0 1-.5346-3.0137l.142.0852 4.783 2.7582a.7712.7712 0 0 0 .7806 0l5.8428-3.3685v2.3324a.0804.0804 0 0 1-.0332.0615L9.74 19.9502a4.4992 4.4992 0 0 1-6.1408-1.6464zM2.3408 7.8956a4.485 4.485 0 0 1 2.3655-1.9728V11.6a.7664.7664 0 0 0 .3879.6765l5.8144 3.3543-2.0201 1.1685a.0757.0757 0 0 1-.071 0l-4.8303-2.7865A4.504 4.504 0 0 1 2.3408 7.872zm16.5963 3.8558L13.1038 8.364 15.1192 7.2a.0757.0757 0 0 1 .071 0l4.8303 2.7913a4.4944 4.4944 0 0 1-.6765 8.1042v-5.6772a.79.79 0 0 0-.407-.667zm2.0107-3.0231l-.142-.0852-4.7735-2.7818a.7759.7759 0 0 0-.7854 0L9.409 9.2297V6.8974a.0662.0662 0 0 1 .0284-.0615l4.8303-2.7866a4.4992 4.4992 0 0 1 6.6802 4.66zM8.3065 12.863l-2.02-1.1638a.0804.0804 0 0 1-.038-.0567V6.0742a4.4992 4.4992 0 0 1 7.3757-3.4537l-.142.0805L8.704 5.459a.7948.7948 0 0 0-.3927.6813zm1.0976-2.3654l2.602-1.4998 2.6069 1.4998v2.9994l-2.5974 1.4997-2.6067-1.4997Z"
|
|
271
|
-
})
|
|
272
|
-
]
|
|
273
|
-
})
|
|
274
|
-
},
|
|
275
|
-
claude: {
|
|
276
|
-
title: isEn ? 'Open in Claude' : '在 Claude 中打开',
|
|
277
|
-
href: `https://claude.ai/new?${new URLSearchParams({
|
|
278
|
-
q
|
|
279
|
-
})}`,
|
|
280
|
-
icon: /*#__PURE__*/ jsxs("svg", {
|
|
281
|
-
fill: "currentColor",
|
|
282
|
-
role: "img",
|
|
283
|
-
viewBox: "0 0 24 24",
|
|
284
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
285
|
-
children: [
|
|
286
|
-
/*#__PURE__*/ jsx("title", {
|
|
287
|
-
children: "Anthropic"
|
|
288
|
-
}),
|
|
289
|
-
/*#__PURE__*/ jsx("path", {
|
|
290
|
-
d: "M17.3041 3.541h-3.6718l6.696 16.918H24Zm-10.6082 0L0 20.459h3.7442l1.3693-3.5527h7.0052l1.3693 3.5528h3.7442L10.5363 3.5409Zm-.3712 10.2232 2.2914-5.9456 2.2914 5.9456Z"
|
|
291
|
-
})
|
|
292
|
-
]
|
|
293
|
-
})
|
|
294
|
-
}
|
|
295
|
-
};
|
|
296
|
-
}, [
|
|
297
|
-
pathname,
|
|
298
|
-
isEn
|
|
299
|
-
]);
|
|
300
|
-
return /*#__PURE__*/ jsx(Fragment, {
|
|
301
|
-
children: /*#__PURE__*/ jsxs("button", {
|
|
302
|
-
ref: dropdownRef,
|
|
303
|
-
className: [
|
|
304
|
-
'rp-not-doc',
|
|
305
|
-
LlmsViewOptions_module_3,
|
|
306
|
-
isOpen ? LlmsViewOptions_module_1 : ''
|
|
307
|
-
].filter(Boolean).join(' '),
|
|
308
|
-
type: "button",
|
|
309
|
-
onClick: toggleDropdown,
|
|
310
|
-
children: [
|
|
311
|
-
text ?? textByLang[lang] ?? 'Open',
|
|
312
|
-
/*#__PURE__*/ jsx(IconArrow, {
|
|
313
|
-
className: `${LlmsViewOptions_module_2} ${isOpen ? _9 : ''}`
|
|
314
|
-
}),
|
|
315
|
-
isOpen && /*#__PURE__*/ jsx("div", {
|
|
316
|
-
className: LlmsViewOptions_module_5,
|
|
317
|
-
children: options.map((item)=>{
|
|
318
|
-
let displayItem = item;
|
|
319
|
-
if ('markdownLink' === item) displayItem = items.markdownLink;
|
|
320
|
-
else if ('chatgpt' === item) displayItem = items.chatgpt;
|
|
321
|
-
else if ('claude' === item) displayItem = items.claude;
|
|
322
|
-
if (displayItem.href) return /*#__PURE__*/ jsxs("a", {
|
|
323
|
-
className: LlmsViewOptions_module_4,
|
|
324
|
-
href: displayItem.href,
|
|
325
|
-
target: "_blank",
|
|
326
|
-
rel: "noopener noreferrer",
|
|
327
|
-
children: [
|
|
328
|
-
/*#__PURE__*/ jsx("span", {
|
|
329
|
-
className: _8,
|
|
330
|
-
children: displayItem.icon
|
|
331
|
-
}),
|
|
332
|
-
/*#__PURE__*/ jsx("span", {
|
|
333
|
-
children: displayItem.title
|
|
334
|
-
}),
|
|
335
|
-
/*#__PURE__*/ jsx("span", {
|
|
336
|
-
className: LlmsViewOptions_module_6,
|
|
337
|
-
children: /*#__PURE__*/ jsx(IconExternalLink, {})
|
|
338
|
-
})
|
|
339
|
-
]
|
|
340
|
-
}, displayItem.title);
|
|
341
|
-
return /*#__PURE__*/ jsxs("div", {
|
|
342
|
-
className: LlmsViewOptions_module_4,
|
|
343
|
-
onClick: displayItem.onClick,
|
|
344
|
-
children: [
|
|
345
|
-
/*#__PURE__*/ jsx("span", {
|
|
346
|
-
className: _8,
|
|
347
|
-
children: displayItem.icon
|
|
348
|
-
}),
|
|
349
|
-
/*#__PURE__*/ jsx("span", {
|
|
350
|
-
children: displayItem.title
|
|
351
|
-
})
|
|
352
|
-
]
|
|
353
|
-
}, displayItem.title);
|
|
354
|
-
})
|
|
355
|
-
})
|
|
356
|
-
]
|
|
357
|
-
})
|
|
358
|
-
});
|
|
359
|
-
};
|
|
360
|
-
export { LlmsContainer, LlmsCopyButton, LlmsViewOptions, useMdUrl };
|
|
1
|
+
export { LlmsContainer, LlmsCopyButton, LlmsViewOptions, useMdUrl } from "@rspress/core/theme";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rspress/plugin-llms",
|
|
3
|
-
"version": "2.0.0-rc.
|
|
3
|
+
"version": "2.0.0-rc.6",
|
|
4
4
|
"description": "A plugin for rspress to generate llms.txt, llms-full.txt, md files to let llm understand your website.",
|
|
5
5
|
"bugs": "https://github.com/web-infra-dev/rspress/issues",
|
|
6
6
|
"repository": {
|
|
@@ -36,13 +36,12 @@
|
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@microsoft/api-extractor": "^7.55.2",
|
|
39
|
-
"@rsbuild/core": "~1.7.
|
|
40
|
-
"@rsbuild/plugin-react": "~1.4.
|
|
41
|
-
"@
|
|
42
|
-
"@rslib/core": "0.19.1",
|
|
39
|
+
"@rsbuild/core": "~1.7.2",
|
|
40
|
+
"@rsbuild/plugin-react": "~1.4.3",
|
|
41
|
+
"@rslib/core": "0.19.2",
|
|
43
42
|
"@types/hast": "^3.0.4",
|
|
44
43
|
"@types/node": "^22.8.1",
|
|
45
|
-
"@types/react": "^19.2.
|
|
44
|
+
"@types/react": "^19.2.8",
|
|
46
45
|
"react": "^19.2.3",
|
|
47
46
|
"rsbuild-plugin-publint": "^0.3.3",
|
|
48
47
|
"typescript": "^5.8.2",
|
|
@@ -50,7 +49,7 @@
|
|
|
50
49
|
"@rspress/config": "1.0.0"
|
|
51
50
|
},
|
|
52
51
|
"peerDependencies": {
|
|
53
|
-
"@rspress/core": "^2.0.0-rc.
|
|
52
|
+
"@rspress/core": "^2.0.0-rc.6"
|
|
54
53
|
},
|
|
55
54
|
"engines": {
|
|
56
55
|
"node": ">=20.9.0"
|
package/dist/rslib-runtime.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
var __webpack_modules__ = {};
|
|
2
|
-
var __webpack_module_cache__ = {};
|
|
3
|
-
function __webpack_require__(moduleId) {
|
|
4
|
-
var cachedModule = __webpack_module_cache__[moduleId];
|
|
5
|
-
if (void 0 !== cachedModule) return cachedModule.exports;
|
|
6
|
-
var module = __webpack_module_cache__[moduleId] = {
|
|
7
|
-
exports: {}
|
|
8
|
-
};
|
|
9
|
-
__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
10
|
-
return module.exports;
|
|
11
|
-
}
|
|
12
|
-
__webpack_require__.m = __webpack_modules__;
|
|
13
|
-
(()=>{
|
|
14
|
-
__webpack_require__.add = function(modules) {
|
|
15
|
-
Object.assign(__webpack_require__.m, modules);
|
|
16
|
-
};
|
|
17
|
-
})();
|
|
18
|
-
export { __webpack_require__ };
|
package/dist/runtime/index.css
DELETED
|
@@ -1,168 +0,0 @@
|
|
|
1
|
-
.llmsContainer-glE3L4 {
|
|
2
|
-
align-items: center;
|
|
3
|
-
gap: 8px;
|
|
4
|
-
margin-bottom: 20px;
|
|
5
|
-
display: flex;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
.llmsCopyButtonContainer-osHvFn {
|
|
9
|
-
border: 1px solid var(--rp-c-divider-light);
|
|
10
|
-
background: var(--rp-c-bg);
|
|
11
|
-
height: 40px;
|
|
12
|
-
color: var(--rp-c-text-1);
|
|
13
|
-
cursor: pointer;
|
|
14
|
-
border-radius: 8px;
|
|
15
|
-
justify-content: center;
|
|
16
|
-
align-items: center;
|
|
17
|
-
gap: 8px;
|
|
18
|
-
padding: 8px 12px;
|
|
19
|
-
font-size: 14px;
|
|
20
|
-
font-style: normal;
|
|
21
|
-
font-weight: 400;
|
|
22
|
-
transition: background .3s, border .3s, opacity .3s;
|
|
23
|
-
display: inline-flex;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
.llmsCopyButtonContainer-osHvFn:hover {
|
|
27
|
-
background: var(--rp-c-bg-mute);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
.llmsCopyButtonContainer-osHvFn.loading-p5nEhg {
|
|
31
|
-
background: var(--rp-c-bg-mute);
|
|
32
|
-
opacity: .5;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
.llmsCopyButtonContainer-osHvFn.success-F4Qj8u .iconCopy-g1n4MZ {
|
|
36
|
-
display: none;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
.llmsCopyButtonContainer-osHvFn.success-F4Qj8u .iconSuccess-PId4Mj {
|
|
40
|
-
opacity: 1;
|
|
41
|
-
visibility: inherit;
|
|
42
|
-
transition-delay: 75ms;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
.iconContainer-G_2NC6 {
|
|
46
|
-
width: 16px;
|
|
47
|
-
height: 16px;
|
|
48
|
-
position: relative;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
.iconCopy-g1n4MZ {
|
|
52
|
-
width: 16px;
|
|
53
|
-
height: 16px;
|
|
54
|
-
position: absolute;
|
|
55
|
-
top: 50%;
|
|
56
|
-
left: 50%;
|
|
57
|
-
transform: translate(-50%, -50%);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
.iconSuccess-PId4Mj {
|
|
61
|
-
visibility: hidden;
|
|
62
|
-
opacity: 0;
|
|
63
|
-
width: 16px;
|
|
64
|
-
height: 16px;
|
|
65
|
-
transition: opacity .2s, transform .2s;
|
|
66
|
-
position: absolute;
|
|
67
|
-
top: 50%;
|
|
68
|
-
left: 50%;
|
|
69
|
-
transform: translate(-50%, -50%);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
.dropdownButton-Mj4g7p {
|
|
73
|
-
border: 1px solid var(--rp-c-divider-light);
|
|
74
|
-
background: var(--rp-c-bg);
|
|
75
|
-
height: 40px;
|
|
76
|
-
color: var(--rp-c-text-1);
|
|
77
|
-
cursor: pointer;
|
|
78
|
-
border-radius: 8px;
|
|
79
|
-
justify-content: center;
|
|
80
|
-
align-items: center;
|
|
81
|
-
gap: 8px;
|
|
82
|
-
padding: 8px 12px;
|
|
83
|
-
font-size: 14px;
|
|
84
|
-
font-style: normal;
|
|
85
|
-
font-weight: 400;
|
|
86
|
-
line-height: 22px;
|
|
87
|
-
transition: background .3s, border .3s;
|
|
88
|
-
display: inline-flex;
|
|
89
|
-
position: relative;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
.dropdownButton-Mj4g7p:hover, .dropdownButton-Mj4g7p.active-SacMuO {
|
|
93
|
-
background: var(--rp-c-bg-mute);
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
.dropdownArrow-UjqrjW {
|
|
97
|
-
transition: transform .2s;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
.dropdownArrow-UjqrjW.rotated-YGs7Vp {
|
|
101
|
-
transform: rotate(180deg);
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
.dropdownMenu-_ggfjT {
|
|
105
|
-
z-index: 2;
|
|
106
|
-
border: 1px solid var(--rp-c-divider-light);
|
|
107
|
-
background: var(--rp-c-bg);
|
|
108
|
-
width: 250px;
|
|
109
|
-
color: var(--rp-c-text-1);
|
|
110
|
-
border-radius: 8px;
|
|
111
|
-
flex-direction: column;
|
|
112
|
-
align-items: flex-start;
|
|
113
|
-
margin-top: 4px;
|
|
114
|
-
padding: 8px;
|
|
115
|
-
animation: .15s ease-in-out fadeIn-_SWLWZ;
|
|
116
|
-
display: inline-flex;
|
|
117
|
-
position: absolute;
|
|
118
|
-
top: 100%;
|
|
119
|
-
left: -10%;
|
|
120
|
-
box-shadow: 0 4px 16px #0000000a;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
@keyframes fadeIn-_SWLWZ {
|
|
124
|
-
0% {
|
|
125
|
-
opacity: 0;
|
|
126
|
-
transform: translateY(-4px);
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
100% {
|
|
130
|
-
opacity: 1;
|
|
131
|
-
transform: translateY(0);
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
.dropdownItem-taWikf {
|
|
136
|
-
text-align: left;
|
|
137
|
-
cursor: pointer;
|
|
138
|
-
background: none;
|
|
139
|
-
border: none;
|
|
140
|
-
border-radius: 8px;
|
|
141
|
-
align-items: center;
|
|
142
|
-
gap: 8px;
|
|
143
|
-
width: 100%;
|
|
144
|
-
padding: 8px 12px;
|
|
145
|
-
font-size: 14px;
|
|
146
|
-
display: flex;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
.dropdownItem-taWikf:hover {
|
|
150
|
-
background: var(--rp-c-bg-mute);
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
.leftIcon-JI6iFK {
|
|
154
|
-
justify-content: center;
|
|
155
|
-
align-items: center;
|
|
156
|
-
width: 16px;
|
|
157
|
-
height: 16px;
|
|
158
|
-
font-size: 16px;
|
|
159
|
-
display: inline-flex;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
.externalIcon-r8tMpa {
|
|
163
|
-
width: 16px;
|
|
164
|
-
height: 16px;
|
|
165
|
-
margin-left: auto;
|
|
166
|
-
font-size: 16px;
|
|
167
|
-
}
|
|
168
|
-
|