Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions e2e/fixtures/search-code-blocks/rspress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,4 @@ import { defineConfig } from 'rspress/config';

export default defineConfig({
root: path.join(__dirname, 'doc'),
search: {
codeBlocks: true,
},
});
2 changes: 1 addition & 1 deletion packages/core/src/node/runtimeModule/siteData/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export async function siteDataVMPlugin(context: FactoryContext) {
searchConfig?.mode === 'remote' ? (searchConfig.domain ?? '') : '';

const searchCodeBlocks =
'codeBlocks' in searchConfig ? Boolean(searchConfig.codeBlocks) : false;
'codeBlocks' in searchConfig ? Boolean(searchConfig.codeBlocks) : true;

const pages = await extractPageData(
replaceRules,
Expand Down
6 changes: 3 additions & 3 deletions packages/document/docs/en/api/config/config-basic.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -312,16 +312,16 @@ export default defineConfig({
### codeBlocks

- Type: `boolean`
- Default: `false`
- Default: `true`

If enabled, the search index will include code block content, which allows users to search code blocks.
Whether to include code block content in the search index, which allows users to search code blocks.

```ts title="rspress.config.ts"
import { defineConfig } from 'rspress/config';

export default defineConfig({
search: {
codeBlocks: true,
codeBlocks: false,
},
});
```
Expand Down
6 changes: 3 additions & 3 deletions packages/document/docs/zh/api/config/config-basic.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -311,16 +311,16 @@ export default defineConfig({
### codeBlocks

- Type: `boolean`
- Default: `false`
- Default: `true`

开启后,搜索的索引将包含代码块的内容,从而允许用户搜索代码块
是否在搜索的索引中包含代码块的内容,这可以让用户搜索代码块

```ts title="rspress.config.ts"
import { defineConfig } from 'rspress/config';

export default defineConfig({
search: {
codeBlocks: true,
codeBlocks: false,
},
});
```
Expand Down
Loading