@rspress/shared 1.41.0 → 1.41.2

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
@@ -1,51 +1,938 @@
1
- export { A as AdditionalPage, B as BaseRuntimePageInfo, r as Config, C as DefaultThemeConfig, O as DocFooter, K as EditLink, F as Feature, t as FilterConfig, V as Footer, i as FrontMatterMeta, H as Header, f as Hero, I as Image, m as LocalSearchOptions, L as Locale, s as LocaleConfig, X as LocaleLink, W as LocaleLinks, q as MarkdownOptions, M as MdxRsOptions, u as Nav, v as NavItem, x as NavItemWithChildren, w as NavItemWithLink, y as NavItemWithLinkAndChildren, N as NormalizedConfig, N as NormalizedDefaultThemeConfig, _ as NormalizedLocales, Z as NormalizedSidebar, Y as NormalizedSidebarGroup, j as PageData, P as PageIndexInfo, g as PageModule, h as PageType, R as Plugin, e as RemotePageInfo, n as RemoteSearchIndexInfo, o as RemoteSearchOptions, c as ReplaceRule, a as Route, b as RouteMeta, k as RouteOptions, R as RspressPlugin, S as SSGConfig, l as SearchHooks, p as SearchOptions, z as Sidebar, G as SidebarDivider, D as SidebarGroup, E as SidebarItem, J as SidebarSectionHeader, d as SiteData, Q as SocialLink, T as SocialLinkIcon, U as UserConfig } from './index-ba0faa42.js';
2
- import '@rsbuild/core';
3
- import 'unified';
4
-
5
- declare const QUERY_REGEXP: RegExp;
6
- declare const HASH_REGEXP: RegExp;
7
- declare const MDX_REGEXP: RegExp;
8
- declare const APPEARANCE_KEY = "rspress-theme-appearance";
9
- declare const SEARCH_INDEX_NAME = "search_index";
10
- declare const RSPRESS_TEMP_DIR = ".rspress";
11
- declare const DEFAULT_HIGHLIGHT_LANGUAGES: string[][];
12
- declare const isSCM: () => boolean;
13
- declare const isProduction: () => boolean;
14
- declare const isDebugMode: () => boolean;
15
- declare const isDevDebugMode: () => boolean;
16
- declare const cleanUrl: (url: string) => string;
17
- declare function slash(str: string): string;
18
- declare function removeHash(str: string): string;
19
- declare function normalizePosixPath(id: string): string;
20
- declare const inBrowser: () => boolean;
21
- declare function addLeadingSlash(url: string): string;
22
- declare function removeLeadingSlash(url: string): string;
23
- declare function addTrailingSlash(url: string): string;
24
- declare function removeTrailingSlash(url: string): string;
25
- declare function normalizeSlash(url: string): string;
26
- declare function isExternalUrl(url?: string): boolean;
27
- declare function isDataUrl(url?: string): boolean;
28
- declare function replaceLang(rawUrl: string, lang: {
29
- current: string;
30
- target: string;
31
- default: string;
32
- }, version: {
33
- current: string;
34
- default: string;
35
- }, base?: string, cleanUrls?: boolean, isPageNotFound?: boolean): string;
36
- declare function replaceVersion(rawUrl: string, version: {
37
- current: string;
38
- target: string;
39
- default: string;
40
- }, base?: string, cleanUrls?: boolean, isPageNotFound?: boolean): string;
41
- declare const parseUrl: (url: string) => {
42
- url: string;
43
- hash: string;
44
- };
45
- declare function normalizeHref(url?: string, cleanUrls?: boolean): string;
46
- declare function withoutLang(path: string, langs: string[]): string;
47
- declare function withoutBase(path: string, base: string): string;
48
- declare function withBase(url: string, base: string): string;
49
- declare function removeBase(url: string, base: string): string;
50
-
51
- export { APPEARANCE_KEY, DEFAULT_HIGHLIGHT_LANGUAGES, HASH_REGEXP, MDX_REGEXP, QUERY_REGEXP, RSPRESS_TEMP_DIR, SEARCH_INDEX_NAME, addLeadingSlash, addTrailingSlash, cleanUrl, inBrowser, isDataUrl, isDebugMode, isDevDebugMode, isExternalUrl, isProduction, isSCM, normalizeHref, normalizePosixPath, normalizeSlash, parseUrl, removeBase, removeHash, removeLeadingSlash, removeTrailingSlash, replaceLang, replaceVersion, slash, withBase, withoutBase, withoutLang };
1
+ import type { PluggableList } from 'unified';
2
+ import type { RsbuildConfig } from '@rsbuild/core';
3
+ import type { RsbuildPlugin } from '@rsbuild/core';
4
+
5
+ /**
6
+ * There are two ways to define what addition routes represent.
7
+ * 1. Define filepath, then the content will be read from the file.
8
+ * 2. Define content, then then content will be written to temp file and read from it.
9
+ */
10
+ export declare interface AdditionalPage {
11
+ routePath: string;
12
+ content?: string;
13
+ filepath?: string;
14
+ }
15
+
16
+ export declare function addLeadingSlash(url: string): string;
17
+
18
+ export declare function addTrailingSlash(url: string): string;
19
+
20
+ export declare const APPEARANCE_KEY = "rspress-theme-appearance";
21
+
22
+ export declare type BaseRuntimePageInfo = Omit<RemoveUnderscoreProps<PageIndexInfo>, 'id' | 'content' | 'domain'>;
23
+
24
+ export declare const cleanUrl: (url: string) => string;
25
+
26
+ export declare type Config = UserConfig | Promise<UserConfig> | ((env: any) => UserConfig | Promise<UserConfig>);
27
+
28
+ export declare const DEFAULT_HIGHLIGHT_LANGUAGES: string[][];
29
+
30
+ export declare interface DefaultThemeConfig {
31
+ /**
32
+ * Whether to enable dark mode.
33
+ * @default true
34
+ */
35
+ darkMode?: boolean;
36
+ /**
37
+ * Custom outline title in the aside component.
38
+ *
39
+ * @default 'ON THIS PAGE'
40
+ */
41
+ outlineTitle?: string;
42
+ /**
43
+ * Whether to show the sidebar in right position.
44
+ */
45
+ outline?: boolean;
46
+ /**
47
+ * The nav items. When it's an object, the key is the version of current doc.
48
+ */
49
+ nav?: NavItem[] | {
50
+ [key: string]: NavItem[];
51
+ };
52
+ /**
53
+ * The sidebar items.
54
+ */
55
+ sidebar?: Sidebar;
56
+ /**
57
+ * Info for the edit link. If it's undefined, the edit link feature will
58
+ * be disabled.
59
+ */
60
+ editLink?: EditLink;
61
+ /**
62
+ * Set custom last updated text.
63
+ *
64
+ * @default 'Last updated'
65
+ */
66
+ lastUpdatedText?: string;
67
+ /**
68
+ * Set custom last updated text.
69
+ *
70
+ * @default false
71
+ */
72
+ lastUpdated?: boolean;
73
+ /**
74
+ * Set custom prev/next labels.
75
+ */
76
+ docFooter?: DocFooter;
77
+ /**
78
+ * The social links to be displayed at the end of the nav bar. Perfect for
79
+ * placing links to social services such as GitHub, X, Facebook, etc.
80
+ */
81
+ socialLinks?: SocialLink[];
82
+ /**
83
+ * The footer configuration.
84
+ */
85
+ footer?: Footer;
86
+ /**
87
+ * The prev page text.
88
+ */
89
+ prevPageText?: string;
90
+ /**
91
+ * The next page text.
92
+ */
93
+ nextPageText?: string;
94
+ /**
95
+ * The source code text.
96
+ */
97
+ sourceCodeText?: string;
98
+ /**
99
+ * Locale config
100
+ */
101
+ locales?: LocaleConfig[];
102
+ /**
103
+ * Whether to open the full text search
104
+ */
105
+ search?: boolean;
106
+ /**
107
+ * The placeholder of search input
108
+ */
109
+ searchPlaceholderText?: string;
110
+ /**
111
+ * The text of no search result
112
+ */
113
+ searchNoResultsText?: string;
114
+ /**
115
+ * The text of suggested query text when no search result
116
+ */
117
+ searchSuggestedQueryText?: string;
118
+ /**
119
+ * The text of overview filter
120
+ */
121
+ overview?: FilterConfig;
122
+ /**
123
+ * The behavior of hiding navbar
124
+ */
125
+ hideNavbar?: 'always' | 'auto' | 'never';
126
+ /**
127
+ * Whether to enable view transition animation for pages switching
128
+ */
129
+ enableContentAnimation?: boolean;
130
+ /**
131
+ * Whether to enable view transition animation for the theme
132
+ */
133
+ enableAppearanceAnimation?: boolean;
134
+ /**
135
+ * Enable scroll to top button on documentation
136
+ * @default false
137
+ */
138
+ enableScrollToTop?: boolean;
139
+ /**
140
+ * Whether to redirect to the closest locale when the user visits the site
141
+ * @default 'auto'
142
+ */
143
+ localeRedirect?: 'auto' | 'never';
144
+ /**
145
+ * Whether to show the fallback heading title when the heading title is not presented but `frontmatter.title` exists
146
+ * @default true
147
+ */
148
+ fallbackHeadingTitle?: boolean;
149
+ }
150
+
151
+ export declare interface DocFooter {
152
+ /**
153
+ * Custom label for previous page button.
154
+ */
155
+ prev?: SidebarItem;
156
+ /**
157
+ * Custom label for next page button.
158
+ */
159
+ next?: SidebarItem;
160
+ }
161
+
162
+ export declare interface EditLink {
163
+ /**
164
+ * Custom repository url for edit link.
165
+ */
166
+ docRepoBaseUrl: string;
167
+ /**
168
+ * Custom text for edit link.
169
+ *
170
+ * @default 'Edit this page'
171
+ */
172
+ text?: string;
173
+ }
174
+
175
+ export declare interface Feature {
176
+ icon: string;
177
+ title: string;
178
+ details: string;
179
+ span?: number;
180
+ link?: string;
181
+ }
182
+
183
+ /**
184
+ * The config of filter component
185
+ */
186
+ export declare interface FilterConfig {
187
+ filterNameText?: string;
188
+ filterPlaceholderText?: string;
189
+ filterNoResultText?: string;
190
+ }
191
+
192
+ export declare interface Footer {
193
+ message?: string;
194
+ }
195
+
196
+ export declare interface FrontMatterMeta {
197
+ title?: string;
198
+ description?: string;
199
+ overview?: boolean;
200
+ pageType?: PageType;
201
+ features?: Feature[];
202
+ hero?: Hero;
203
+ sidebar?: boolean;
204
+ outline?: boolean;
205
+ lineNumbers?: boolean;
206
+ overviewHeaders?: number;
207
+ titleSuffix?: string;
208
+ head?: [string, Record<string, string>][];
209
+ context?: string;
210
+ [key: string]: unknown;
211
+ }
212
+
213
+ export declare const HASH_REGEXP: RegExp;
214
+
215
+ export declare interface Header {
216
+ id: string;
217
+ text: string;
218
+ depth: number;
219
+ charIndex: number;
220
+ }
221
+
222
+ export declare interface Hero {
223
+ name: string;
224
+ text: string;
225
+ tagline: string;
226
+ image?: {
227
+ src: string | {
228
+ dark: string;
229
+ light: string;
230
+ };
231
+ alt: string;
232
+ /**
233
+ * `srcset` and `sizes` are attributes of `<img>` tag. Please refer to https://mdn.io/srcset for the usage.
234
+ * When the value is an array, rspress will join array members with commas.
235
+ **/
236
+ sizes?: string | string[];
237
+ srcset?: string | string[];
238
+ };
239
+ actions: {
240
+ text: string;
241
+ link: string;
242
+ theme: 'brand' | 'alt';
243
+ }[];
244
+ }
245
+
246
+ declare type Image_2 = string | {
247
+ src: string;
248
+ alt?: string;
249
+ };
250
+ export { Image_2 as Image }
251
+
252
+ export declare const inBrowser: () => boolean;
253
+
254
+ export declare function isDataUrl(url?: string): boolean;
255
+
256
+ export declare const isDebugMode: () => boolean;
257
+
258
+ export declare const isDevDebugMode: () => boolean;
259
+
260
+ export declare function isExternalUrl(url?: string): boolean;
261
+
262
+ export declare const isProduction: () => boolean;
263
+
264
+ export declare const isSCM: () => boolean;
265
+
266
+ export declare interface Locale {
267
+ lang: string;
268
+ label: string;
269
+ title?: string;
270
+ description?: string;
271
+ }
272
+
273
+ /**
274
+ * locale config
275
+ */
276
+ export declare interface LocaleConfig {
277
+ /**
278
+ * Site i18n config, which will recover the locales config in the site level.
279
+ */
280
+ lang: string;
281
+ title?: string;
282
+ description?: string;
283
+ label: string;
284
+ /**
285
+ * Theme i18n config
286
+ */
287
+ nav?: Nav;
288
+ sidebar?: Sidebar;
289
+ outlineTitle?: string;
290
+ lastUpdatedText?: string;
291
+ lastUpdated?: boolean;
292
+ editLink?: EditLink;
293
+ prevPageText?: string;
294
+ nextPageText?: string;
295
+ sourceCodeText?: string;
296
+ langRoutePrefix?: string;
297
+ searchPlaceholderText?: string;
298
+ searchNoResultsText?: string;
299
+ searchSuggestedQueryText?: string;
300
+ overview?: FilterConfig;
301
+ }
302
+
303
+ export declare interface LocaleLink {
304
+ text: string;
305
+ link: string;
306
+ }
307
+
308
+ export declare interface LocaleLinks {
309
+ text: string;
310
+ items: LocaleLink[];
311
+ }
312
+
313
+ export declare type LocalSearchOptions = SearchHooks & {
314
+ mode?: 'local';
315
+ /**
316
+ * Whether to generate separate search index for each version
317
+ */
318
+ versioned?: boolean;
319
+ /**
320
+ * If enabled, the search index will include code block content, which allows users to search code blocks.
321
+ * @default false
322
+ */
323
+ codeBlocks?: boolean;
324
+ };
325
+
326
+ export declare interface MarkdownOptions {
327
+ remarkPlugins?: PluggableList;
328
+ rehypePlugins?: PluggableList;
329
+ /**
330
+ * Whether to enable check dead links, default is false
331
+ */
332
+ checkDeadLinks?: boolean;
333
+ showLineNumbers?: boolean;
334
+ /**
335
+ * Whether to wrap code by default, default is false
336
+ */
337
+ defaultWrapCode?: boolean;
338
+ /**
339
+ * Register global components in mdx files
340
+ */
341
+ globalComponents?: string[];
342
+ /**
343
+ * Code highlighter, default is prism for performance reason
344
+ */
345
+ codeHighlighter?: 'prism' | 'shiki';
346
+ /**
347
+ * Register prism languages
348
+ */
349
+ highlightLanguages?: (string | [string, string])[];
350
+ /**
351
+ * Whether to enable mdx-rs, default is true
352
+ */
353
+ mdxRs?: boolean | MdxRsOptions;
354
+ /**
355
+ * @deprecated, use `mdxRs` instead
356
+ */
357
+ experimentalMdxRs?: boolean;
358
+ }
359
+
360
+ export declare const MDX_REGEXP: RegExp;
361
+
362
+ export declare interface MdxRsOptions {
363
+ /**
364
+ * Determine whether the file use mdxRs compiler
365
+ */
366
+ include?: (filepath: string) => boolean;
367
+ }
368
+
369
+ export declare type Nav = NavItem[] | {
370
+ [key: string]: NavItem[];
371
+ };
372
+
373
+ export declare type NavItem = NavItemWithLink | NavItemWithChildren | NavItemWithLinkAndChildren;
374
+
375
+ export declare interface NavItemWithChildren {
376
+ text?: string;
377
+ tag?: string;
378
+ items: NavItemWithLink[];
379
+ position?: 'left' | 'right';
380
+ }
381
+
382
+ export declare type NavItemWithLink = {
383
+ text: string;
384
+ link: string;
385
+ tag?: string;
386
+ activeMatch?: string;
387
+ position?: 'left' | 'right';
388
+ };
389
+
390
+ export declare interface NavItemWithLinkAndChildren {
391
+ text: string;
392
+ link: string;
393
+ items: NavItemWithLink[];
394
+ tag?: string;
395
+ activeMatch?: string;
396
+ position?: 'left' | 'right';
397
+ }
398
+
399
+ declare interface NormalizedConfig extends Omit<DefaultThemeConfig, 'locales' | 'sidebar'> {
400
+ locales: NormalizedLocales[];
401
+ sidebar: NormalizedSidebar;
402
+ }
403
+ export { NormalizedConfig }
404
+ export { NormalizedConfig as NormalizedDefaultThemeConfig }
405
+
406
+ export declare interface NormalizedLocales extends Omit<LocaleConfig, 'sidebar'> {
407
+ sidebar: NormalizedSidebar;
408
+ }
409
+
410
+ export declare interface NormalizedSidebar {
411
+ [path: string]: (NormalizedSidebarGroup | SidebarItem | SidebarDivider)[];
412
+ }
413
+
414
+ export declare interface NormalizedSidebarGroup extends Omit<SidebarGroup, 'items'> {
415
+ items: (SidebarDivider | SidebarItem | NormalizedSidebarGroup)[];
416
+ collapsible: boolean;
417
+ collapsed: boolean;
418
+ }
419
+
420
+ export declare function normalizeHref(url?: string, cleanUrls?: boolean): string;
421
+
422
+ export declare function normalizePosixPath(id: string): string;
423
+
424
+ export declare function normalizeSlash(url: string): string;
425
+
426
+ export declare interface PageData {
427
+ siteData: SiteData<DefaultThemeConfig>;
428
+ page: BaseRuntimePageInfo & {
429
+ headingTitle?: string;
430
+ pagePath: string;
431
+ lastUpdatedTime?: string;
432
+ description?: string;
433
+ pageType: PageType;
434
+ [key: string]: unknown;
435
+ };
436
+ }
437
+
438
+ /**
439
+ * @description search-index.json file
440
+ * "_foo" is the private field that won't be written to search-index.json file
441
+ * and should not be used in the runtime (usePageData).
442
+ */
443
+ export declare type PageIndexInfo = {
444
+ id: number;
445
+ title: string;
446
+ routePath: string;
447
+ toc: Header[];
448
+ content: string;
449
+ _html: string;
450
+ frontmatter: Record<string, unknown>;
451
+ lang: string;
452
+ version: string;
453
+ domain: string;
454
+ _filepath: string;
455
+ _relativePath: string;
456
+ };
457
+
458
+ export declare interface PageModule<T extends React.ComponentType<unknown>> {
459
+ default: T;
460
+ frontmatter?: FrontMatterMeta;
461
+ content?: string;
462
+ [key: string]: unknown;
463
+ }
464
+
465
+ export declare type PageType = 'home' | 'doc' | 'custom' | '404' | 'blank';
466
+
467
+ export declare const parseUrl: (url: string) => {
468
+ url: string;
469
+ hash: string;
470
+ };
471
+
472
+ export declare const QUERY_REGEXP: RegExp;
473
+
474
+ export declare type RemotePageInfo = PageIndexInfo & {
475
+ _matchesPosition: {
476
+ content: {
477
+ start: number;
478
+ length: number;
479
+ }[];
480
+ };
481
+ };
482
+
483
+ export declare type RemoteSearchIndexInfo = string | {
484
+ value: string;
485
+ label: string;
486
+ };
487
+
488
+ export declare type RemoteSearchOptions = SearchHooks & {
489
+ mode: 'remote';
490
+ apiUrl: string;
491
+ domain?: string;
492
+ indexName: string;
493
+ searchIndexes?: RemoteSearchIndexInfo[];
494
+ searchLoading?: boolean;
495
+ };
496
+
497
+ export declare function removeBase(url: string, base: string): string;
498
+
499
+ export declare function removeHash(str: string): string;
500
+
501
+ export declare function removeLeadingSlash(url: string): string;
502
+
503
+ export declare function removeTrailingSlash(url: string): string;
504
+
505
+ declare type RemoveUnderscoreProps<T> = {
506
+ [K in keyof T as K extends `_${string}` ? never : K]: T[K];
507
+ };
508
+
509
+ export declare function replaceLang(rawUrl: string, lang: {
510
+ current: string;
511
+ target: string;
512
+ default: string;
513
+ }, version: {
514
+ current: string;
515
+ default: string;
516
+ }, base?: string, cleanUrls?: boolean, isPageNotFound?: boolean): string;
517
+
518
+ export declare interface ReplaceRule {
519
+ search: string | RegExp;
520
+ replace: string;
521
+ }
522
+
523
+ export declare function replaceVersion(rawUrl: string, version: {
524
+ current: string;
525
+ target: string;
526
+ default: string;
527
+ }, base?: string, cleanUrls?: boolean, isPageNotFound?: boolean): string;
528
+
529
+ export declare interface Route {
530
+ path: string;
531
+ element: React.ReactElement;
532
+ filePath: string;
533
+ preload: () => Promise<PageModule<React.ComponentType<unknown>>>;
534
+ lang: string;
535
+ }
536
+
537
+ export declare interface RouteMeta {
538
+ routePath: string;
539
+ absolutePath: string;
540
+ relativePath: string;
541
+ pageName: string;
542
+ lang: string;
543
+ version: string;
544
+ }
545
+
546
+ export declare interface RouteOptions {
547
+ /**
548
+ * The extension name of the filepath that will be converted to a route
549
+ * @default ['js','jsx','ts','tsx','md','mdx']
550
+ */
551
+ extensions?: string[];
552
+ /**
553
+ * Include extra files from being converted to routes
554
+ */
555
+ include?: string[];
556
+ /**
557
+ * Exclude files from being converted to routes
558
+ */
559
+ exclude?: string[];
560
+ /**
561
+ * use links without .html files
562
+ */
563
+ cleanUrls?: boolean;
564
+ }
565
+
566
+ export declare const RSPRESS_TEMP_DIR = ".rspress";
567
+
568
+ declare interface RspressPlugin {
569
+ /**
570
+ * Name of the plugin.
571
+ */
572
+ name: string;
573
+ /**
574
+ * Global style
575
+ */
576
+ globalStyles?: string;
577
+ /**
578
+ * Markdown options.
579
+ */
580
+ markdown?: {
581
+ remarkPlugins?: PluggableList;
582
+ rehypePlugins?: PluggableList;
583
+ globalComponents?: string[];
584
+ };
585
+ /**
586
+ * Rsbuild config.
587
+ */
588
+ builderConfig?: RsbuildConfig;
589
+ /**
590
+ * Inject global components.
591
+ */
592
+ globalUIComponents?: (string | [string, object])[];
593
+ /**
594
+ * Modify doc config.
595
+ */
596
+ config?: (config: UserConfig, utils: {
597
+ addPlugin: (plugin: RspressPlugin) => void;
598
+ removePlugin: (pluginName: string) => void;
599
+ }, isProd: boolean) => UserConfig | Promise<UserConfig>;
600
+ /**
601
+ * Callback before build
602
+ */
603
+ beforeBuild?: (config: UserConfig, isProd: boolean) => void | Promise<void>;
604
+ /**
605
+ * Callback after build
606
+ */
607
+ afterBuild?: (config: UserConfig, isProd: boolean) => void | Promise<void>;
608
+ /**
609
+ * Extend every page's data
610
+ */
611
+ extendPageData?: (pageData: PageIndexInfo & {
612
+ [key: string]: unknown;
613
+ }, isProd: boolean) => void | Promise<void>;
614
+ /**
615
+ * Add custom route
616
+ */
617
+ addPages?: (config: UserConfig, isProd: boolean) => AdditionalPage[] | Promise<AdditionalPage[]>;
618
+ /**
619
+ * Add runtime modules
620
+ */
621
+ addRuntimeModules?: (config: UserConfig, isProd: boolean) => Record<string, string> | Promise<Record<string, string>>;
622
+ /**
623
+ * Callback after route generated
624
+ */
625
+ routeGenerated?: (routes: RouteMeta[], isProd: boolean) => Promise<void> | void;
626
+ /**
627
+ * Add addition ssg routes, for dynamic routes.
628
+ */
629
+ addSSGRoutes?: (config: UserConfig, isProd: boolean) => {
630
+ path: string;
631
+ }[] | Promise<{
632
+ path: string;
633
+ }[]>;
634
+ /**
635
+ * @private
636
+ * Modify search index data.
637
+ */
638
+ modifySearchIndexData?: (data: PageIndexInfo[], isProd: boolean) => void | Promise<void>;
639
+ }
640
+ export { RspressPlugin as Plugin }
641
+ export { RspressPlugin }
642
+
643
+ export declare const SEARCH_INDEX_NAME = "search_index";
644
+
645
+ export declare interface SearchHooks {
646
+ /**
647
+ * The search hook function path. The corresponding file should export a function named `onSearch`.
648
+ */
649
+ searchHooks?: string;
650
+ }
651
+
652
+ export declare type SearchOptions = LocalSearchOptions | RemoteSearchOptions | false;
653
+
654
+ export declare interface Sidebar {
655
+ [path: string]: (SidebarGroup | SidebarItem | SidebarDivider | SidebarSectionHeader)[];
656
+ }
657
+
658
+ export declare type SidebarDivider = {
659
+ dividerType: 'dashed' | 'solid';
660
+ };
661
+
662
+ export declare interface SidebarGroup {
663
+ text: string;
664
+ link?: string;
665
+ tag?: string;
666
+ items: (SidebarItem | SidebarDivider | SidebarGroup | string)[];
667
+ collapsible?: boolean;
668
+ collapsed?: boolean;
669
+ /**
670
+ * For hmr usage in development
671
+ */
672
+ _fileKey?: string;
673
+ overviewHeaders?: number[];
674
+ context?: string;
675
+ }
676
+
677
+ export declare type SidebarItem = {
678
+ text: string;
679
+ link: string;
680
+ tag?: string;
681
+ /**
682
+ * For hmr usage in development
683
+ */
684
+ _fileKey?: string;
685
+ overviewHeaders?: number[];
686
+ context?: string;
687
+ };
688
+
689
+ export declare type SidebarSectionHeader = {
690
+ sectionHeaderText: string;
691
+ tag?: string;
692
+ };
693
+
694
+ export declare interface SiteData<ThemeConfig = NormalizedConfig> {
695
+ root: string;
696
+ base: string;
697
+ lang: string;
698
+ route: RouteOptions;
699
+ locales: {
700
+ lang: string;
701
+ label: string;
702
+ }[];
703
+ title: string;
704
+ description: string;
705
+ icon: string;
706
+ themeConfig: ThemeConfig;
707
+ logo: string | {
708
+ dark: string;
709
+ light: string;
710
+ };
711
+ logoText: string;
712
+ pages: BaseRuntimePageInfo[];
713
+ search: SearchOptions;
714
+ ssg: boolean;
715
+ markdown: {
716
+ showLineNumbers: boolean;
717
+ defaultWrapCode: boolean;
718
+ codeHighlighter: 'prism' | 'shiki';
719
+ };
720
+ multiVersion: {
721
+ default: string;
722
+ versions: string[];
723
+ };
724
+ }
725
+
726
+ export declare function slash(str: string): string;
727
+
728
+ export declare interface SocialLink {
729
+ icon: SocialLinkIcon;
730
+ mode: 'link' | 'text' | 'img' | 'dom';
731
+ content: string;
732
+ }
733
+
734
+ export declare type SocialLinkIcon = 'lark' | 'discord' | 'facebook' | 'github' | 'instagram' | 'linkedin' | 'slack' | 'x' | 'youtube' | 'wechat' | 'qq' | 'juejin' | 'zhihu' | 'bilibili' | 'weibo' | 'gitlab' | 'X' | 'bluesky' | {
735
+ svg: string;
736
+ };
737
+
738
+ export declare type SSGConfig = boolean | {
739
+ strict?: boolean;
740
+ };
741
+
742
+ export declare interface UserConfig<ThemeConfig = DefaultThemeConfig> {
743
+ /**
744
+ * The root directory of the site.
745
+ * @default 'docs'
746
+ */
747
+ root?: string;
748
+ /**
749
+ * Path to the logo file in nav bar.
750
+ */
751
+ logo?: string | {
752
+ dark: string;
753
+ light: string;
754
+ };
755
+ /**
756
+ * The text of the logo in nav bar.
757
+ * @default ''
758
+ */
759
+ logoText?: string;
760
+ /**
761
+ * Base path of the site.
762
+ * @default '/'
763
+ */
764
+ base?: string;
765
+ /**
766
+ * Path to html icon file.
767
+ */
768
+ icon?: string;
769
+ /**
770
+ * Default language of the site.
771
+ */
772
+ lang?: string;
773
+ /**
774
+ * Title of the site.
775
+ * @default 'Rspress'
776
+ */
777
+ title?: string;
778
+ /**
779
+ * Description of the site.
780
+ * @default ''
781
+ */
782
+ description?: string;
783
+ /**
784
+ * Head tags.
785
+ */
786
+ head?: (string | [string, Record<string, string>] | ((route: RouteMeta) => string | [string, Record<string, string>] | undefined))[];
787
+ /**
788
+ * I18n config of the site.
789
+ */
790
+ locales?: Locale[];
791
+ /**
792
+ * The i18n text data source path. Default is `i18n.json` in cwd.
793
+ */
794
+ i18nSourcePath?: string;
795
+ /**
796
+ * Theme config.
797
+ */
798
+ themeConfig?: ThemeConfig;
799
+ /**
800
+ * Rsbuild Configuration
801
+ */
802
+ builderConfig?: RsbuildConfig;
803
+ /**
804
+ * The custom config of vite-plugin-route
805
+ */
806
+ route?: RouteOptions;
807
+ /**
808
+ * The custom config of markdown compile
809
+ */
810
+ markdown?: MarkdownOptions;
811
+ /**
812
+ * Doc plugins
813
+ */
814
+ plugins?: RspressPlugin[];
815
+ /**
816
+ * Replace rule, will replace the content of the page.
817
+ */
818
+ replaceRules?: ReplaceRule[];
819
+ /**
820
+ * Output directory
821
+ */
822
+ outDir?: string;
823
+ /**
824
+ * Custom theme directory
825
+ */
826
+ themeDir?: string;
827
+ /**
828
+ * Global components
829
+ */
830
+ globalUIComponents?: (string | [string, object])[];
831
+ /**
832
+ * Global styles, is a Absolute path
833
+ */
834
+ globalStyles?: string;
835
+ /**
836
+ * Search options
837
+ */
838
+ search?: SearchOptions;
839
+ /**
840
+ * Whether to enable ssg, default is true
841
+ */
842
+ ssg?: SSGConfig;
843
+ /**
844
+ * Whether to enable medium-zoom, default is true
845
+ */
846
+ mediumZoom?: boolean | {
847
+ selector?: string;
848
+ options?: ZoomOptions;
849
+ };
850
+ /**
851
+ * Add some extra builder plugins
852
+ */
853
+ builderPlugins?: RsbuildPlugin[];
854
+ /**
855
+ * Multi version config
856
+ */
857
+ multiVersion?: {
858
+ /**
859
+ * The default version
860
+ */
861
+ default?: string;
862
+ /**
863
+ * The version list, such as ['v1', 'v2']
864
+ */
865
+ versions: string[];
866
+ };
867
+ /**
868
+ * Language parity checking config
869
+ */
870
+ languageParity?: {
871
+ /**
872
+ * Whether to enable language parity checking
873
+ */
874
+ enabled: boolean;
875
+ /**
876
+ * Directories to include in the parity check
877
+ */
878
+ include: string[];
879
+ /**
880
+ * Directories to exclude from the parity check
881
+ */
882
+ exclude: string[];
883
+ };
884
+ }
885
+
886
+ export declare function withBase(url: string, base: string): string;
887
+
888
+ export declare function withoutBase(path: string, base: string): string;
889
+
890
+ export declare function withoutLang(path: string, langs: string[]): string;
891
+
892
+ declare interface ZoomContainer {
893
+ width?: number
894
+ height?: number
895
+ top?: number
896
+ bottom?: number
897
+ right?: number
898
+ left?: number
899
+ }
900
+
901
+ declare interface ZoomOptions {
902
+ /**
903
+ * The space outside the zoomed image.
904
+ *
905
+ * @default 0
906
+ */
907
+ margin?: number
908
+
909
+ /**
910
+ * The background of the overlay.
911
+ *
912
+ * @default '#fff'
913
+ */
914
+ background?: string
915
+
916
+ /**
917
+ * The number of pixels to scroll to close the zoom.
918
+ *
919
+ * @default 40
920
+ */
921
+ scrollOffset?: number
922
+
923
+ /**
924
+ * The viewport to render the zoom in.
925
+ *
926
+ * @default null
927
+ */
928
+ container?: string | HTMLElement | ZoomContainer
929
+
930
+ /**
931
+ * The template element to display on zoom.
932
+ *
933
+ * @default null
934
+ */
935
+ template?: string | HTMLTemplateElement
936
+ }
937
+
938
+ export { }