@rspress/core 2.1.3 → 2.1.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.
Files changed (95) hide show
  1. package/dist/bb~0.js +1 -0
  2. package/dist/b~0.js +3026 -1
  3. package/dist/cli/index.js +1 -1
  4. package/dist/config/loadConfigFile.js +1 -1
  5. package/dist/eject-theme/components/Callout/index.test.tsx +52 -0
  6. package/dist/eject-theme/components/Callout/index.tsx +11 -0
  7. package/dist/eject-theme/components/CodeBlock/index.tsx +1 -1
  8. package/dist/eject-theme/components/HomeFeature/index.scss +12 -0
  9. package/dist/eject-theme/components/HomeHero/index.scss +4 -1
  10. package/dist/eject-theme/components/PageTabs/index.test.tsx +45 -0
  11. package/dist/eject-theme/components/PageTabs/index.tsx +17 -0
  12. package/dist/eject-theme/components/Prompt/index.tsx +2 -1
  13. package/dist/eject-theme/components/Sidebar/SidebarGroup.scss +14 -0
  14. package/dist/eject-theme/components/Sidebar/SidebarGroup.tsx +6 -1
  15. package/dist/eject-theme/components/Sidebar/SidebarItem.scss +0 -10
  16. package/dist/eject-theme/components/Sidebar/SidebarItem.tsx +2 -2
  17. package/dist/eject-theme/components/Tabs/index.test.tsx +26 -4
  18. package/dist/eject-theme/components/Tabs/index.tsx +8 -5
  19. package/dist/node/PluginDriver.js +1 -1
  20. package/dist/node/auto-nav-sidebar/index.js +1 -1
  21. package/dist/node/auto-nav-sidebar/locales.js +1 -1
  22. package/dist/node/auto-nav-sidebar/normalize.js +1 -1
  23. package/dist/node/auto-nav-sidebar/utils.js +1 -1
  24. package/dist/node/auto-nav-sidebar/walk.js +1 -1
  25. package/dist/node/eject.js +1 -1
  26. package/dist/node/initRsbuild.js +6 -1
  27. package/dist/node/mdx/options.js +1 -1
  28. package/dist/node/mdx/processor.js +1 -1
  29. package/dist/node/mdx/rehypePlugins/codeMeta.js +1 -1
  30. package/dist/node/mdx/rehypePlugins/headerAnchor.js +1 -1
  31. package/dist/node/mdx/rehypePlugins/shiki.js +1 -1
  32. package/dist/node/mdx/remarkPlugins/builtin.js +1 -1
  33. package/dist/node/route/RoutePage.js +1 -1
  34. package/dist/node/route/RouteService.js +1 -1
  35. package/dist/node/route/extractPageData.js +19 -3
  36. package/dist/node/route/normalizeRoutePath.js +1 -1
  37. package/dist/node/route/routeChunkAssets.d.ts +2 -0
  38. package/dist/node/route/routeChunkAssets.js +6 -0
  39. package/dist/node/runtimeModule/i18n/getI18nData.js +1 -1
  40. package/dist/node/runtimeModule/i18n/rsbuildPlugin.js +1 -1
  41. package/dist/node/runtimeModule/pageData/createPageData.js +1 -1
  42. package/dist/node/runtimeModule/pageData/rsbuildPlugin.js +1 -1
  43. package/dist/node/runtimeModule/searchHooks.js +1 -1
  44. package/dist/node/runtimeModule/siteData/createSiteData.js +1 -1
  45. package/dist/node/runtimeModule/siteData/normalizeThemeConfig.js +1 -1
  46. package/dist/node/runtimeModule/siteData/rsbuildPlugin.js +1 -1
  47. package/dist/node/serve.js +1 -1
  48. package/dist/node/sitemap.js +1 -1
  49. package/dist/node/ssg/alternateLinks.js +1 -1
  50. package/dist/node/ssg/renderHtmlTemplate.js +5 -1
  51. package/dist/node/ssg/renderPageWorker.js +1 -1
  52. package/dist/node/ssg/renderPages.js +1 -1
  53. package/dist/node/ssg/rsbuildPluginSSG.js +1 -1
  54. package/dist/node/ssg/ssgEnv.js +1 -1
  55. package/dist/node/ssg-md/llms/emitLlmsTxt.js +1 -1
  56. package/dist/node/ssg-md/llms/llmsTxt.js +1 -1
  57. package/dist/node/ssg-md/remarkSplitMdx.d.ts +0 -4
  58. package/dist/node/ssg-md/remarkSplitMdx.js +266 -163
  59. package/dist/node/ssg-md/renderPage.js +1 -1
  60. package/dist/node/ssg-md/renderPages.js +1 -1
  61. package/dist/node/ssg-md/rsbuildPluginSSGMD.js +1 -1
  62. package/dist/node/utils/checkLanguageParity.js +1 -1
  63. package/dist/node/utils/createHash.js +1 -1
  64. package/dist/node/utils/flattenMdxContent.js +1 -1
  65. package/dist/node/utils/getPageKey.js +1 -1
  66. package/dist/node/utils/reactAlias.js +3 -1
  67. package/dist/n~0.js +1 -1
  68. package/dist/{tx~0.js → q~0.js} +3 -3
  69. package/dist/shiki-transformers.js +1 -1
  70. package/dist/theme/components/Callout/index.js +10 -0
  71. package/dist/theme/components/CodeBlock/index.d.ts +1 -1
  72. package/dist/theme/components/HomeFeature/index.css +10 -0
  73. package/dist/theme/components/HomeHero/index.css +5 -1
  74. package/dist/theme/components/PageTabs/index.js +12 -0
  75. package/dist/theme/components/Prompt/index.js +1 -1
  76. package/dist/theme/components/Sidebar/SidebarGroup.css +14 -0
  77. package/dist/theme/components/Sidebar/SidebarGroup.js +29 -22
  78. package/dist/theme/components/Sidebar/SidebarItem.css +0 -10
  79. package/dist/theme/components/Sidebar/SidebarItem.js +2 -2
  80. package/dist/theme/components/Tabs/index.js +8 -5
  81. package/dist/tinypool~0.js +2 -2
  82. package/dist/y~0.js +1 -1
  83. package/package.json +14 -11
  84. package/skills/rspress-best-practices/SKILL.md +82 -0
  85. package/skills/rspress-custom-theme/SKILL.md +242 -0
  86. package/skills/rspress-custom-theme/references/css-variables.md +177 -0
  87. package/skills/rspress-custom-theme/references/eject-components.md +154 -0
  88. package/skills/rspress-custom-theme/references/layout-slots.md +153 -0
  89. package/skills/rspress-description-generator/SKILL.md +118 -0
  90. package/skills/rspress-docs-generator/SKILL.md +60 -0
  91. package/skills/rspress-docs-generator/references/create-new-docs.md +73 -0
  92. package/skills/rspress-docs-generator/references/doc-structure-conventions.md +117 -0
  93. package/skills/rspress-docs-generator/references/maintain-docs-for-prs.md +31 -0
  94. package/skills/rspress-docs-generator/references/rspress-version-guard.md +13 -0
  95. package/dist/p~0.js +0 -3032
package/dist/n~0.js CHANGED
@@ -1117,7 +1117,7 @@ class SignalExit extends SignalExitBase {
1117
1117
  }
1118
1118
  }
1119
1119
  const mjs_process = globalThis.process;
1120
- const { onExit: onExit, load: mjs_load, unload: unload } = signalExitWrap(processOk(mjs_process) ? new SignalExit(mjs_process) : new SignalExitFallback());
1120
+ const { onExit, load: mjs_load, unload } = signalExitWrap(processOk(mjs_process) ? new SignalExit(mjs_process) : new SignalExitFallback());
1121
1121
  const DEFAULT_FORCE_KILL_TIMEOUT = 5000;
1122
1122
  const spawnedKill = (kill, signal = 'SIGTERM', options = {})=>{
1123
1123
  const killResult = kill(signal);
@@ -7,9 +7,9 @@ export { default as rehype_raw } from "rehype-raw";
7
7
  export { default as remark_cjk_friendly } from "remark-cjk-friendly";
8
8
  export { default as remark_cjk_friendly_gfm_strikethrough } from "remark-cjk-friendly-gfm-strikethrough";
9
9
  export { default as remark_gfm } from "remark-gfm";
10
- export { default as remark_mdx } from "remark-mdx";
11
- export { default as remark_stringify } from "remark-stringify";
12
- export { unified } from "unified";
10
+ export { gfmToMarkdown } from "mdast-util-gfm";
11
+ export { toMarkdown } from "mdast-util-to-markdown";
12
+ export { mdxToMarkdown } from "mdast-util-mdx";
13
13
  export { visit } from "unist-util-visit";
14
14
  export { default as github_slugger } from "@rspress/shared/github-slugger";
15
15
  export { headingRank } from "hast-util-heading-rank";
@@ -1,4 +1,4 @@
1
- import { transformerNotationDiff, transformerNotationWordHighlight, transformerNotationFocus, transformerNotationErrorLevel, transformerRemoveNotationEscape, transformerNotationHighlight } from "./b~0.js";
1
+ import { transformerNotationDiff, transformerNotationWordHighlight, transformerNotationFocus, transformerNotationErrorLevel, transformerRemoveNotationEscape, transformerNotationHighlight } from "./bb~0.js";
2
2
  import "./node/mdx/rehypePlugins/transformers/index.js";
3
3
  export * from "@shikijs/transformers";
4
4
  function getShikiTransformers(transformers = []) {
@@ -4,6 +4,16 @@ function capitalize(type) {
4
4
  return type.charAt(0).toUpperCase() + type.slice(1);
5
5
  }
6
6
  function Callout({ type, title, children }) {
7
+ if (import.meta.env.SSG_MD) return /*#__PURE__*/ jsxs("blockquote", {
8
+ children: [
9
+ /*#__PURE__*/ jsx("p", {
10
+ children: /*#__PURE__*/ jsx("strong", {
11
+ children: title ?? capitalize(type)
12
+ })
13
+ }),
14
+ children
15
+ ]
16
+ });
7
17
  const isDetails = 'details' === type;
8
18
  if (isDetails) return /*#__PURE__*/ jsxs("details", {
9
19
  className: `rp-callout rp-callout--${type}`,
@@ -17,7 +17,7 @@ export type CodeBlockProps = {
17
17
  fold?: boolean;
18
18
  height?: number;
19
19
  containerElementClassName?: string;
20
- codeButtonGroupProps?: Omit<CodeButtonGroupProps, 'preElementRef' | 'wrapCode' | 'toggleWrapCode'>;
20
+ codeButtonGroupProps?: Omit<CodeButtonGroupProps, 'copyElementRef' | 'wrapCode' | 'toggleWrapCode'>;
21
21
  children?: React.ReactNode;
22
22
  };
23
23
  /**
@@ -49,6 +49,16 @@
49
49
  position: relative;
50
50
  }
51
51
 
52
+ @media (prefers-reduced-motion: reduce) {
53
+ .rp-home-feature__item, .rp-home-feature__item-wrapper {
54
+ transform: none !important;
55
+ }
56
+
57
+ .rp-home-feature__item__shine {
58
+ display: none;
59
+ }
60
+ }
61
+
52
62
  .rp-home-feature__card {
53
63
  border: 1px solid var(--rp-c-divider-light);
54
64
  background: var(--rp-home-feature-bg);
@@ -23,7 +23,11 @@
23
23
 
24
24
  @media (width <= 600px) {
25
25
  .rp-home-hero {
26
- padding: 10px;
26
+ padding: 10px 20px;
27
+ }
28
+
29
+ .rp-home-hero .rp-home-hero__container {
30
+ gap: 18px;
27
31
  }
28
32
 
29
33
  .rp-home-hero .rp-home-hero__title {
@@ -51,6 +51,18 @@ const PageTabs = /*#__PURE__*/ forwardRef((props, ref)=>{
51
51
  const { children: rawChildren, tabPosition = 'left', className, id = 'page' } = props;
52
52
  const children = Children.toArray(rawChildren).filter((child)=>!('string' == typeof child && '' === child.trim()) && /*#__PURE__*/ isValidElement(child));
53
53
  const { tabValues, navigateToTab, injectScript } = usePageTabs(id, children);
54
+ if (import.meta.env.SSG_MD) return /*#__PURE__*/ jsx(Fragment, {
55
+ children: tabValues.map(({ label, content }, index)=>/*#__PURE__*/ jsxs("div", {
56
+ children: [
57
+ null != label && /*#__PURE__*/ jsx("p", {
58
+ children: /*#__PURE__*/ jsx("strong", {
59
+ children: label
60
+ })
61
+ }),
62
+ content
63
+ ]
64
+ }, index))
65
+ });
54
66
  return /*#__PURE__*/ jsxs(Fragment, {
55
67
  children: [
56
68
  /*#__PURE__*/ jsx("script", {
@@ -133,7 +133,7 @@ function CopyablePrompt({ className, defaultCollapsed = true, description, eyebr
133
133
  return /*#__PURE__*/ jsxs("div", {
134
134
  ...props,
135
135
  ref: cardRef,
136
- className: clsx('rp-prompt', className),
136
+ className: clsx('rp-prompt', 'rp-not-doc', className),
137
137
  style: {
138
138
  '--rp-prompt-accent': AGENT_ICONS[iconIndex].color,
139
139
  ...style
@@ -2,3 +2,17 @@
2
2
  color: var(--rp-c-text-1);
3
3
  }
4
4
 
5
+ .rp-sidebar-group__items {
6
+ position: relative;
7
+ overflow: hidden;
8
+ }
9
+
10
+ .rp-sidebar-group__line {
11
+ background-color: var(--rp-c-divider-light);
12
+ pointer-events: none;
13
+ width: 1px;
14
+ position: absolute;
15
+ top: 0;
16
+ bottom: 0;
17
+ }
18
+
@@ -70,28 +70,35 @@ function SidebarGroup(props) {
70
70
  gridTemplateRows: collapsed ? '0fr' : '1fr',
71
71
  transition: 'grid-template-rows 0.2s ease-out'
72
72
  },
73
- children: /*#__PURE__*/ jsx("div", {
74
- style: {
75
- overflow: 'hidden'
76
- },
77
- children: item.items?.map((item, index)=>isSidebarGroup(item) ? /*#__PURE__*/ jsx(SidebarGroup, {
78
- id: `${id}-${index}`,
79
- depth: depth + 1,
80
- item: item,
81
- setSidebarData: setSidebarData,
82
- className: "rp-sidebar-item--group-item"
83
- }, `${id}-${index}`) : isSidebarDivider(item) ? /*#__PURE__*/ jsx(SidebarDivider, {
84
- depth: depth + 1,
85
- dividerType: item.dividerType
86
- }, index) : isSidebarSectionHeader(item) ? /*#__PURE__*/ jsx(SidebarSectionHeader, {
87
- icon: item.icon,
88
- sectionHeaderText: item.sectionHeaderText,
89
- tag: item.tag
90
- }, index) : /*#__PURE__*/ jsx(SidebarItem, {
91
- item: item,
92
- depth: depth + 1,
93
- className: "rp-sidebar-item--group-item"
94
- }, index))
73
+ children: /*#__PURE__*/ jsxs("div", {
74
+ className: "rp-sidebar-group__items",
75
+ children: [
76
+ /*#__PURE__*/ jsx("span", {
77
+ "aria-hidden": "true",
78
+ className: "rp-sidebar-group__line",
79
+ style: {
80
+ left: (depth + 1) * 20 - 7
81
+ }
82
+ }),
83
+ item.items?.map((item, index)=>isSidebarGroup(item) ? /*#__PURE__*/ jsx(SidebarGroup, {
84
+ id: `${id}-${index}`,
85
+ depth: depth + 1,
86
+ item: item,
87
+ setSidebarData: setSidebarData,
88
+ className: "rp-sidebar-item--group-item"
89
+ }, `${id}-${index}`) : isSidebarDivider(item) ? /*#__PURE__*/ jsx(SidebarDivider, {
90
+ depth: depth + 1,
91
+ dividerType: item.dividerType
92
+ }, index) : isSidebarSectionHeader(item) ? /*#__PURE__*/ jsx(SidebarSectionHeader, {
93
+ icon: item.icon,
94
+ sectionHeaderText: item.sectionHeaderText,
95
+ tag: item.tag
96
+ }, index) : /*#__PURE__*/ jsx(SidebarItem, {
97
+ item: item,
98
+ depth: depth + 1,
99
+ className: "rp-sidebar-item--group-item"
100
+ }, index))
101
+ ]
95
102
  })
96
103
  })
97
104
  ]
@@ -42,16 +42,6 @@
42
42
  outline-offset: -2px;
43
43
  }
44
44
 
45
- .rp-sidebar-item--group-item:before {
46
- content: "";
47
- background-color: var(--rp-c-divider-light);
48
- width: 1px;
49
- position: absolute;
50
- top: -2px;
51
- bottom: 0;
52
- left: -7px;
53
- }
54
-
55
45
  .rp-sidebar-item--group-item.rp-sidebar-item--active .rp-sidebar-item__left:before {
56
46
  content: "";
57
47
  background-color: var(--rp-c-brand);
@@ -57,7 +57,7 @@ function SidebarItemRaw({ active, text, icon, tag, link, context, className, lef
57
57
  'rp-sidebar-item--pending': isPending
58
58
  }, className),
59
59
  style: {
60
- marginLeft: 24 * depth
60
+ marginLeft: 20 * depth
61
61
  },
62
62
  'data-depth': depth,
63
63
  ...context ? {
@@ -72,7 +72,7 @@ function SidebarItemRaw({ active, text, icon, tag, link, context, className, lef
72
72
  'rp-sidebar-item--active': active
73
73
  }, className),
74
74
  style: {
75
- marginLeft: 24 * depth
75
+ marginLeft: 20 * depth
76
76
  },
77
77
  'data-depth': depth,
78
78
  ...context ? {
@@ -37,13 +37,16 @@ const Tabs = /*#__PURE__*/ forwardRef((props, ref)=>{
37
37
  const [activeIndex, setActiveIndex] = useState(initialActiveIndex);
38
38
  const [storageIndex, setStorageIndex] = useStorageValue(`${groupIdPrefix}${groupId}`, initialActiveIndex.toString());
39
39
  if (import.meta.env.SSG_MD) return /*#__PURE__*/ jsx(Fragment, {
40
- children: tabValues.map(({ label, content })=>/*#__PURE__*/ jsxs(Fragment, {
40
+ children: tabValues.map(({ label, content }, index)=>/*#__PURE__*/ jsxs("div", {
41
41
  children: [
42
- `\n**${label}**\n\n`,
43
- content,
44
- `\n`
42
+ null != label && /*#__PURE__*/ jsx("p", {
43
+ children: /*#__PURE__*/ jsx("strong", {
44
+ children: label
45
+ })
46
+ }),
47
+ content
45
48
  ]
46
- }))
49
+ }, index))
47
50
  });
48
51
  const currentIndex = groupId ? Number(storageIndex) : activeIndex;
49
52
  return /*#__PURE__*/ jsxs("div", {
@@ -124,12 +124,12 @@ var ProcessWorker = class {
124
124
  if (this.port) this.port.on("message", (message$1)=>this.send({
125
125
  ...message$1,
126
126
  source: "port",
127
- __tinypool_worker_message__: __tinypool_worker_message__
127
+ __tinypool_worker_message__
128
128
  }));
129
129
  return this.send({
130
130
  ...message,
131
131
  source: "pool",
132
- __tinypool_worker_message__: __tinypool_worker_message__
132
+ __tinypool_worker_message__
133
133
  });
134
134
  }
135
135
  on(event, callback) {
package/dist/y~0.js CHANGED
@@ -1,5 +1,5 @@
1
1
  var package_namespaceObject = {
2
- rE: "2.1.3"
2
+ rE: "2.1.5"
3
3
  };
4
4
  function pMap(iterable, mapper, options) {
5
5
  return mapConcurrently(iterable, mapper, options, false);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspress/core",
3
- "version": "2.1.3",
3
+ "version": "2.1.5",
4
4
  "description": "The Rspress Documentation Framework",
5
5
  "bugs": "https://github.com/web-infra-dev/rspress/issues",
6
6
  "repository": {
@@ -54,35 +54,38 @@
54
54
  "dist",
55
55
  "meta-json-schema.json",
56
56
  "nav-json-schema.json",
57
+ "skills",
57
58
  "static",
58
59
  "index.html"
59
60
  ],
60
61
  "dependencies": {
61
62
  "@mdx-js/mdx": "^3.1.1",
62
63
  "@mdx-js/react": "^3.1.1",
63
- "@rsbuild/core": "^2.2.14",
64
+ "@rsbuild/core": "^2.3.3",
64
65
  "@rsbuild/plugin-react": "~2.1.1",
65
- "@rspress/shared": "2.1.3",
66
+ "@rspress/shared": "2.1.5",
66
67
  "@shikijs/rehype": "^4.2.0",
67
68
  "@shikijs/transformers": "^4.2.0",
68
69
  "@types/mdast": "^4.0.4",
69
70
  "@types/react": "^19.3.0",
70
- "@unhead/react": "^2.1.17",
71
+ "@unhead/react": "^2.1.18",
71
72
  "body-scroll-lock": "4.0.0-beta.0",
72
73
  "clsx": "2.1.1",
73
74
  "copy-to-clipboard": "^3.3.3",
74
75
  "flexsearch": "0.8.212",
75
76
  "hast-util-heading-rank": "^3.0.0",
76
77
  "hast-util-to-jsx-runtime": "^2.3.7",
78
+ "mdast-util-gfm": "^3.1.0",
77
79
  "mdast-util-mdx": "^3.0.0",
78
80
  "mdast-util-mdxjs-esm": "^2.0.1",
81
+ "mdast-util-to-markdown": "^2.1.2",
79
82
  "medium-zoom": "1.1.2",
80
83
  "nprogress": "^0.2.0",
81
84
  "react": "^19.3.1",
82
85
  "react-dom": "^19.3.1",
83
86
  "react-lazy-with-preload": "^2.2.1",
84
- "react-render-to-markdown": "19.1.0",
85
- "react-router-dom": "^7.18.5",
87
+ "react-render-to-markdown": "19.2.0",
88
+ "react-router-dom": "^7.18.6",
86
89
  "rehype-external-links": "^3.0.0",
87
90
  "rehype-raw": "^7.0.0",
88
91
  "remark-cjk-friendly": "^2.3.4",
@@ -108,15 +111,15 @@
108
111
  "@types/node": "^22.8.1",
109
112
  "@types/nprogress": "^0.2.3",
110
113
  "@types/react-dom": "^19.3.0",
111
- "@types/web": "^0.0.362",
112
- "cac": "^7.1.0",
114
+ "@types/web": "^0.0.367",
115
+ "cac": "^7.1.1",
113
116
  "execa": "8.0.1",
114
- "mdast-util-directive": "^3.1.1",
117
+ "mdast-util-directive": "^3.2.1",
115
118
  "mdast-util-mdx-expression": "^2.0.1",
116
- "memfs": "^4.80.0",
119
+ "memfs": "^4.80.1",
117
120
  "p-map": "^7.1.1",
118
121
  "picocolors": "^1.1.1",
119
- "postcss": "8.5.32",
122
+ "postcss": "8.5.33",
120
123
  "remark-directive": "^4.0.0",
121
124
  "rsbuild-plugin-publint": "^1.0.0",
122
125
  "rsbuild-plugin-virtual-module": "0.4.5",
@@ -0,0 +1,82 @@
1
+ ---
2
+ name: rspress-best-practices
3
+ description: Configure, review, or troubleshoot Rspress v2 sites, including content conventions, navigation, MDX, assets, search, and deployment.
4
+ ---
5
+
6
+ # Rspress best practices
7
+
8
+ Apply these rules when writing or reviewing Rspress (v2) sites.
9
+
10
+ ## Configuration
11
+
12
+ - Use `rspress.config.ts` and `defineConfig` from `@rspress/core`
13
+ - Set `root` explicitly when docs are not under the default `docs/` directory
14
+ - Keep site-wide settings such as `title`, `description`, `icon`, `logo`, `base`, and `lang` in config instead of repeating them in page files
15
+ - Prefer first-class Rspress options before custom theme code or low-level bundler overrides
16
+ - Keep custom theme code in a top-level `theme/` directory and import original theme pieces from `@rspress/core/theme-original`
17
+
18
+ ## CLI
19
+
20
+ - Use `rspress dev` for local development
21
+ - Use `rspress build` for production output
22
+ - Use `rspress preview` only for local preview of the built site
23
+ - Use `rspress eject` only when CSS variables, class overrides, or layout wrapping cannot solve the customization
24
+
25
+ ## Docs structure and navigation
26
+
27
+ - Keep docs content under one clear docs root and group pages by topic or workflow, not by team ownership
28
+ - Use `_meta.json` or `_nav.json` to control sidebar and navigation labels/order instead of encoding order in filenames
29
+ - Put reusable MDX snippets or shared components in shared files instead of duplicating them across pages
30
+ - Keep landing pages concise and link to deeper task-oriented guides from them
31
+
32
+ ## Writing and frontmatter
33
+
34
+ - Add clear `title` and `description` frontmatter, and set `sidebar`, `outline`, `navbar`, or `footer` only when page defaults are not enough
35
+ - Use `pageType: home`, `doc`, `doc-wide`, `custom`, or `blank` intentionally based on layout needs
36
+ - Write task-first headings and short intros; avoid marketing-heavy copy in technical docs
37
+ - Prefer one topic per page and split overly long pages by workflow or feature area
38
+ - Keep code examples minimal, runnable, and version-accurate
39
+
40
+ ## MDX and components
41
+
42
+ - Use MDX for interactive docs and embedded components, but keep the main narrative understandable as plain markdown
43
+ - Prefer documented Rspress theme/runtime APIs over importing from internal source paths
44
+ - For app-wide UI or providers, use `globalUIComponents` or theme overrides instead of repeating imports in each page
45
+
46
+ ## Theme and styling
47
+
48
+ - Prefer CSS variables for brand colors, spacing, and surface styling
49
+ - Prefer BEM class overrides or `Layout` slots before ejecting built-in components
50
+ - In `theme/` files, keep `export * from '@rspress/core/theme-original'` unless intentionally replacing a named export
51
+ - Avoid full component ejection unless config, CSS, and wrapping cannot meet the requirement
52
+
53
+ ## I18n, Search, And AI
54
+
55
+ - For multilingual sites, organize locale content under per-language directories and keep navigation mirrored where practical
56
+ - Keep descriptions and other frontmatter text in the same language as the page content
57
+ - Configure search intentionally: use local search for small or medium sites, and hosted search when scale or cross-version indexing requires it
58
+ - Enable `llms` or `ssgMd` only when the site benefits from machine-readable outputs, and keep descriptions accurate because those outputs surface page summaries
59
+
60
+ ## Assets and public files
61
+
62
+ - Import source-managed images and components from docs/theme source when they belong to the content
63
+ - Use `public/` only for assets that must keep stable URL paths, such as favicons, social images, or download files
64
+ - Reference public assets by absolute site path and make sure they still work when `base` is set
65
+
66
+ ## Plugins and integration
67
+
68
+ - Prefer official Rspress plugins for search, preview, and API-doc scenarios before building custom solutions
69
+ - For component or library docs, use `@rspress/plugin-preview` and `@rspress/plugin-api-docgen` when interactive demos or API tables are needed
70
+ - Keep plugin usage explicit in config and remove unused plugins to reduce maintenance cost
71
+
72
+ ## Build, Deploy, And debugging
73
+
74
+ - Validate both `rspress dev` and `rspress build`; a page that works in dev can still fail during static generation
75
+ - Verify broken links, missing assets, and wrong `base` handling before deployment
76
+ - Keep generated output out of source control unless the hosting workflow explicitly requires committed artifacts
77
+ - When debugging content issues, inspect the resolved docs root, frontmatter, and theme overrides before assuming a bundler problem
78
+
79
+ ## Documentation
80
+
81
+ - For the latest Rspress docs, read https://rspress.rs/llms.txt
82
+ - Use the config and API docs when checking exact option names or current behavior