@rspress/shared 2.0.0-rc.5 → 2.0.0-rc.7

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.d.ts CHANGED
@@ -33,6 +33,13 @@ export declare interface EditLink {
33
33
  }
34
34
 
35
35
  export declare interface Feature {
36
+ /**
37
+ * Feature icon, supports:
38
+ * - Emoji: '🚀'
39
+ * - HTML string: '<span class="icon">...</span>'
40
+ * - SVG string: '<svg>...</svg>'
41
+ * - Image URL: '/icons/feature.svg' or 'https://example.com/icon.png'
42
+ */
36
43
  icon: string;
37
44
  title: string;
38
45
  details: string;
@@ -127,6 +134,9 @@ export declare interface I18nText {
127
134
  languagesText?: I18nTextValue;
128
135
  versionsText?: I18nTextValue;
129
136
  themeText?: I18nTextValue;
137
+ copyMarkdownText?: I18nTextValue;
138
+ copyMarkdownLinkText?: I18nTextValue;
139
+ openInText?: I18nTextValue;
130
140
  menuTitle?: I18nTextValue;
131
141
  outlineTitle?: I18nTextValue;
132
142
  scrollToTopText?: I18nTextValue;
@@ -165,6 +175,33 @@ export declare function isExternalUrl(url?: string): boolean;
165
175
 
166
176
  export declare const isProduction: () => boolean;
167
177
 
178
+ /**
179
+ * Configuration for LLMS UI components displayed on H1 headers.
180
+ * When enabled, LlmsCopyButton and LlmsViewOptions will be automatically
181
+ * added below H1 headers without requiring custom getCustomMDXComponent.
182
+ * @default false
183
+ */
184
+ export declare type LlmsUI = {
185
+ /**
186
+ * Options for LlmsViewOptions component dropdown menu.
187
+ * @default ['markdownLink', 'chatgpt', 'claude']
188
+ */
189
+ viewOptions?: LlmsViewOption[];
190
+ } | boolean;
191
+
192
+ /**
193
+ * Option item for LlmsViewOptions component.
194
+ */
195
+ export declare type LlmsViewOption = 'markdownLink' | 'chatgpt' | 'claude' | {
196
+ title: string;
197
+ icon?: React.ReactNode;
198
+ onClick?: () => void;
199
+ } | {
200
+ title: string;
201
+ href: string;
202
+ icon?: React.ReactNode;
203
+ };
204
+
168
205
  export declare interface Locale {
169
206
  lang: string;
170
207
  label: string;
@@ -226,6 +263,12 @@ export declare interface MarkdownOptions {
226
263
  * @default true
227
264
  */
228
265
  crossCompilerCache?: boolean;
266
+ /**
267
+ * Whether to automatically extract a description from the markdown content,
268
+ * typically from the first paragraph, for use in page metadata or previews.
269
+ * @default true
270
+ */
271
+ extractDescription?: boolean;
229
272
  }
230
273
 
231
274
  export declare const matchNavbar: (item: NavItemWithLink, currentPathname: string) => boolean;
@@ -322,8 +365,8 @@ export declare interface PageIndexInfo {
322
365
  title: string;
323
366
  toc: Header[];
324
367
  content: string;
368
+ description?: string;
325
369
  _flattenContent?: string;
326
- _html: string;
327
370
  frontmatter: FrontMatterMeta;
328
371
  lang: string;
329
372
  version: string;
@@ -620,6 +663,7 @@ export declare interface SiteData {
620
663
  light: string;
621
664
  };
622
665
  logoText: string;
666
+ logoHref: string;
623
667
  search: SearchOptions;
624
668
  markdown: {
625
669
  showLineNumbers: boolean;
@@ -719,6 +763,12 @@ declare type ThemeConfig = {
719
763
  * @default true
720
764
  */
721
765
  fallbackHeadingTitle?: boolean;
766
+ /**
767
+ * LLMS UI components configuration.
768
+ * When llmsUI.enableOnH1 is true, LlmsCopyButton and LlmsViewOptions
769
+ * will be automatically added below H1 headers.
770
+ */
771
+ llmsUI?: LlmsUI;
722
772
  };
723
773
  export { ThemeConfig as DefaultThemeConfig }
724
774
  export { ThemeConfig }
@@ -741,6 +791,11 @@ export declare interface UserConfig {
741
791
  * @default ''
742
792
  */
743
793
  logoText?: string;
794
+ /**
795
+ * Custom link for the logo.
796
+ * @default '/${lang}/'
797
+ */
798
+ logoHref?: string;
744
799
  /**
745
800
  * Base path of the site.
746
801
  * @default '/'
@@ -32,6 +32,13 @@ declare interface EditLink {
32
32
  export declare const extractTextAndId: (title?: string) => [text: string, customId: string];
33
33
 
34
34
  declare interface Feature {
35
+ /**
36
+ * Feature icon, supports:
37
+ * - Emoji: '🚀'
38
+ * - HTML string: '<span class="icon">...</span>'
39
+ * - SVG string: '<svg>...</svg>'
40
+ * - Image URL: '/icons/feature.svg' or 'https://example.com/icon.png'
41
+ */
35
42
  icon: string;
36
43
  title: string;
37
44
  details: string;
@@ -132,6 +139,9 @@ declare interface I18nText {
132
139
  languagesText?: I18nTextValue;
133
140
  versionsText?: I18nTextValue;
134
141
  themeText?: I18nTextValue;
142
+ copyMarkdownText?: I18nTextValue;
143
+ copyMarkdownLinkText?: I18nTextValue;
144
+ openInText?: I18nTextValue;
135
145
  menuTitle?: I18nTextValue;
136
146
  outlineTitle?: I18nTextValue;
137
147
  scrollToTopText?: I18nTextValue;
@@ -158,6 +168,33 @@ declare type I18nTextValue = {
158
168
  [key: string]: string;
159
169
  };
160
170
 
171
+ /**
172
+ * Configuration for LLMS UI components displayed on H1 headers.
173
+ * When enabled, LlmsCopyButton and LlmsViewOptions will be automatically
174
+ * added below H1 headers without requiring custom getCustomMDXComponent.
175
+ * @default false
176
+ */
177
+ declare type LlmsUI = {
178
+ /**
179
+ * Options for LlmsViewOptions component dropdown menu.
180
+ * @default ['markdownLink', 'chatgpt', 'claude']
181
+ */
182
+ viewOptions?: LlmsViewOption[];
183
+ } | boolean;
184
+
185
+ /**
186
+ * Option item for LlmsViewOptions component.
187
+ */
188
+ declare type LlmsViewOption = 'markdownLink' | 'chatgpt' | 'claude' | {
189
+ title: string;
190
+ icon?: React.ReactNode;
191
+ onClick?: () => void;
192
+ } | {
193
+ title: string;
194
+ href: string;
195
+ icon?: React.ReactNode;
196
+ };
197
+
161
198
  export declare function loadFrontMatter<TFrontmatter extends Record<string, unknown> = FrontMatterMeta>(source: string, filepath: string, root: string, outputWarning?: boolean): {
162
199
  frontmatter: TFrontmatter;
163
200
  content: string;
@@ -225,6 +262,12 @@ declare interface MarkdownOptions {
225
262
  * @default true
226
263
  */
227
264
  crossCompilerCache?: boolean;
265
+ /**
266
+ * Whether to automatically extract a description from the markdown content,
267
+ * typically from the first paragraph, for use in page metadata or previews.
268
+ * @default true
269
+ */
270
+ extractDescription?: boolean;
228
271
  }
229
272
 
230
273
  export declare const mergeDocConfig: (...configs: UserConfig[]) => Promise<UserConfig>;
@@ -269,8 +312,8 @@ declare interface PageIndexInfo {
269
312
  title: string;
270
313
  toc: Header[];
271
314
  content: string;
315
+ description?: string;
272
316
  _flattenContent?: string;
273
- _html: string;
274
317
  frontmatter: FrontMatterMeta;
275
318
  lang: string;
276
319
  version: string;
@@ -568,6 +611,12 @@ declare type ThemeConfig = {
568
611
  * @default true
569
612
  */
570
613
  fallbackHeadingTitle?: boolean;
614
+ /**
615
+ * LLMS UI components configuration.
616
+ * When llmsUI.enableOnH1 is true, LlmsCopyButton and LlmsViewOptions
617
+ * will be automatically added below H1 headers.
618
+ */
619
+ llmsUI?: LlmsUI;
571
620
  };
572
621
 
573
622
  declare interface UserConfig {
@@ -588,6 +637,11 @@ declare interface UserConfig {
588
637
  * @default ''
589
638
  */
590
639
  logoText?: string;
640
+ /**
641
+ * Custom link for the logo.
642
+ * @default '/${lang}/'
643
+ */
644
+ logoHref?: string;
591
645
  /**
592
646
  * Base path of the site.
593
647
  * @default '/'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspress/shared",
3
- "version": "2.0.0-rc.5",
3
+ "version": "2.0.0-rc.7",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/web-infra-dev/rspress.git",
@@ -32,17 +32,17 @@
32
32
  "dist"
33
33
  ],
34
34
  "dependencies": {
35
- "@rsbuild/core": "~1.7.1",
36
- "@shikijs/rehype": "^3.20.0",
35
+ "@rsbuild/core": "2.0.0-alpha.2",
36
+ "@shikijs/rehype": "^3.21.0",
37
37
  "gray-matter": "4.0.3",
38
38
  "lodash-es": "^4.17.22",
39
39
  "unified": "^11.0.5"
40
40
  },
41
41
  "devDependencies": {
42
- "@rslib/core": "0.19.1",
42
+ "@rslib/core": "0.19.2",
43
43
  "@types/lodash-es": "^4.17.12",
44
44
  "@types/node": "^22.8.1",
45
- "@types/react": "^19.2.7",
45
+ "@types/react": "^19.2.8",
46
46
  "mdast-util-mdx-jsx": "^3.2.0",
47
47
  "medium-zoom": "1.1.0",
48
48
  "rimraf": "^6.1.2",