@rspress/shared 2.0.0-beta.3 → 2.0.0-beta.5

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,5 +1,6 @@
1
1
  import type { loadConfig } from '@rsbuild/core';
2
2
  import type { PluggableList } from 'unified';
3
+ import type { RehypeShikiOptions } from '@shikijs/rehype';
3
4
  import type { RsbuildConfig } from '@rsbuild/core';
4
5
  import type { RsbuildPlugin } from '@rsbuild/core';
5
6
 
@@ -143,7 +144,7 @@ export declare interface DefaultThemeConfig {
143
144
  * Whether to redirect to the closest locale when the user visits the site
144
145
  * @default 'auto'
145
146
  */
146
- localeRedirect?: 'auto' | 'never';
147
+ localeRedirect?: 'auto' | 'never' | 'only-default-lang';
147
148
  /**
148
149
  * Whether to show the fallback heading title when the heading title is not presented but `frontmatter.title` exists
149
150
  * @default true
@@ -352,13 +353,9 @@ export declare interface MarkdownOptions {
352
353
  */
353
354
  globalComponents?: string[];
354
355
  /**
355
- * Code highlighter, default is prism for performance reason
356
+ * @type import('@shikijs/rehype').RehypeShikiOptions
356
357
  */
357
- codeHighlighter?: 'prism' | 'shiki';
358
- /**
359
- * Register prism languages
360
- */
361
- highlightLanguages?: (string | [string, string])[];
358
+ shiki?: Partial<PluginShikiOptions>;
362
359
  }
363
360
 
364
361
  export declare const matchNavbar: (item: NavItemWithLink, currentPathname: string, base: string) => boolean;
@@ -476,6 +473,8 @@ export declare const parseUrl: (url: string) => {
476
473
  hash: string;
477
474
  };
478
475
 
476
+ declare type PluginShikiOptions = RehypeShikiOptions;
477
+
479
478
  export declare const QUERY_REGEXP: RegExp;
480
479
 
481
480
  export declare type RemotePageInfo = PageIndexInfo & {
@@ -724,7 +723,7 @@ export declare interface SiteData<ThemeConfig = NormalizedConfig> {
724
723
  markdown: {
725
724
  showLineNumbers: boolean;
726
725
  defaultWrapCode: boolean;
727
- codeHighlighter: 'prism' | 'shiki';
726
+ shiki: Partial<PluginShikiOptions>;
728
727
  };
729
728
  multiVersion: {
730
729
  default: string;
@@ -4,6 +4,7 @@ import type { MdxJsxExpressionAttribute } from 'mdast-util-mdx-jsx';
4
4
  import type { MdxJsxFlowElement } from 'mdast-util-mdx-jsx';
5
5
  import type { MdxJsxTextElement } from 'mdast-util-mdx-jsx';
6
6
  import type { PluggableList } from 'unified';
7
+ import type { RehypeShikiOptions } from '@shikijs/rehype';
7
8
  import type { RsbuildConfig } from '@rsbuild/core';
8
9
  import type { RsbuildPlugin } from '@rsbuild/core';
9
10
 
@@ -131,7 +132,7 @@ declare interface Config {
131
132
  * Whether to redirect to the closest locale when the user visits the site
132
133
  * @default 'auto'
133
134
  */
134
- localeRedirect?: 'auto' | 'never';
135
+ localeRedirect?: 'auto' | 'never' | 'only-default-lang';
135
136
  /**
136
137
  * Whether to show the fallback heading title when the heading title is not presented but `frontmatter.title` exists
137
138
  * @default true
@@ -314,13 +315,9 @@ declare interface MarkdownOptions {
314
315
  */
315
316
  globalComponents?: string[];
316
317
  /**
317
- * Code highlighter, default is prism for performance reason
318
+ * @type import('@shikijs/rehype').RehypeShikiOptions
318
319
  */
319
- codeHighlighter?: 'prism' | 'shiki';
320
- /**
321
- * Register prism languages
322
- */
323
- highlightLanguages?: (string | [string, string])[];
320
+ shiki?: Partial<PluginShikiOptions>;
324
321
  }
325
322
 
326
323
  export declare const mergeDocConfig: (...configs: UserConfig[]) => Promise<UserConfig>;
@@ -378,6 +375,8 @@ declare interface PageIndexInfo {
378
375
 
379
376
  declare type PageType = 'home' | 'doc' | 'custom' | '404' | 'blank';
380
377
 
378
+ declare type PluginShikiOptions = RehypeShikiOptions;
379
+
381
380
  declare type RemoteSearchIndexInfo = string | {
382
381
  value: string;
383
382
  label: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspress/shared",
3
- "version": "2.0.0-beta.3",
3
+ "version": "2.0.0-beta.5",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/web-infra-dev/rspress.git",
@@ -32,17 +32,18 @@
32
32
  "dist"
33
33
  ],
34
34
  "dependencies": {
35
- "@rsbuild/core": "1.3.13",
35
+ "@rsbuild/core": "1.3.17",
36
+ "@shikijs/rehype": "^3.2.2",
36
37
  "gray-matter": "4.0.3",
37
38
  "lodash-es": "^4.17.21",
38
39
  "unified": "^11.0.5"
39
40
  },
40
41
  "devDependencies": {
41
- "@rslib/core": "0.6.7",
42
+ "@rslib/core": "0.6.8",
42
43
  "@types/jest": "~29.5.14",
43
44
  "@types/lodash-es": "^4.17.12",
44
45
  "@types/node": "^18.11.17",
45
- "@types/react": "^18.3.20",
46
+ "@types/react": "^18.3.21",
46
47
  "mdast-util-mdx-jsx": "^3.2.0",
47
48
  "medium-zoom": "1.1.0",
48
49
  "rimraf": "^6.0.1",