diff --git a/.github/ISSUE_TEMPLATE/1-bug-report.en-US.yml b/.github/ISSUE_TEMPLATE/1-bug-report.en-US.yml index d933943a0..db8c50d23 100644 --- a/.github/ISSUE_TEMPLATE/1-bug-report.en-US.yml +++ b/.github/ISSUE_TEMPLATE/1-bug-report.en-US.yml @@ -50,6 +50,6 @@ body: placeholder: | for example: 1. execute `yarn dev` - 2. find `xxx` error message in the console + 2. find the error message in the console validations: required: true diff --git a/.github/ISSUE_TEMPLATE/3-bug-report.zh-Hans.yml b/.github/ISSUE_TEMPLATE/3-bug-report.zh-Hans.yml index 764e675cb..3b43757a2 100644 --- a/.github/ISSUE_TEMPLATE/3-bug-report.zh-Hans.yml +++ b/.github/ISSUE_TEMPLATE/3-bug-report.zh-Hans.yml @@ -50,6 +50,6 @@ body: placeholder: | 比如: 1. 执行 `yarn dev` - 2. 控制台出现 `xxx` 异常信息 + 2. 控制台出现异常信息 validations: required: true diff --git a/.vscode/extensions.json b/.vscode/extensions.json index a729da5e9..5fa6d5e2a 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -1,3 +1,3 @@ { - "recommendations": ["biomejs.biome", "esbenp.prettier-vscode"] + "recommendations": ["biomejs.biome", "esbenp.prettier-vscode", "streetsidesoftware.code-spell-checker"] } diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 064ada2ce..b43ad0519 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -204,7 +204,7 @@ The format of PR titles follow Conventional Commits. An example: ``` -feat(plugin-swc): Add `xxx` config +feat(plugin-swc): Add `myOption` config ^ ^ ^ | | |__ Subject | |_______ Scope diff --git a/cspell.config.cjs b/cspell.config.cjs new file mode 100644 index 000000000..c1af9c2e9 --- /dev/null +++ b/cspell.config.cjs @@ -0,0 +1,31 @@ +const { banWords } = require('cspell-ban-words'); + +module.exports = { + version: '0.2', + language: 'en', + files: ['**/*.{ts,tsx,js,jsx,md,mdx}'], + enableFiletypes: ['mdx'], + ignoreRegExpList: [ + // ignore markdown anchors such as [fooBar](#foobar) + '#.*?\\)', + ], + ignorePaths: [ + 'dist', + 'dist-*', + 'compiled', + 'coverage', + 'doc_build', + 'playwright-report', + 'node_modules', + 'pnpm-lock.yaml', + ], + flagWords: banWords, + dictionaries: ['dictionary'], + dictionaryDefinitions: [ + { + name: 'dictionary', + path: './scripts/dictionary.txt', + addWords: true, + }, + ], +}; diff --git a/package.json b/package.json index 8c9a4cdf7..19d1d9aa4 100644 --- a/package.json +++ b/package.json @@ -8,6 +8,7 @@ "bump": "modern bump", "pre": "modern pre", "prepare": "npm run build && husky install", + "check-spell": "npx cspell", "dev": "cross-env NX_DAEMON=false NX_REJECT_UNKNOWN_LOCAL_CACHE=0 nx run-many -t dev --exclude @rspress-fixture/*", "build": "cross-env NX_DAEMON=false NX_REJECT_UNKNOWN_LOCAL_CACHE=0 nx run-many -t build --exclude @rspress-fixture/*", "test": "pnpm test:unit && pnpm test:e2e", @@ -52,19 +53,20 @@ "@playwright/test": "1.33.0", "@types/cross-spawn": "^6.0.2", "@types/fs-extra": "^11.0.1", - "cross-spawn": "^7.0.3", "cross-env": "^7.0.3", + "cross-spawn": "^7.0.3", + "cspell-ban-words": "^0.0.3", "execa": "8.0.1", "fs-extra": "^11.1.1", "get-port": "5.0.0", "husky": "^8.0.0", "lint-staged": "~13.1.0", + "nx": "17.0.2", "playwright": "1.33.0", + "prettier": "3.2.2", "tree-kill": "^1.2.2", "ts-node": "^10.9.1", - "vitest": "0.34.1", - "nx": "17.0.2", - "prettier": "3.2.2" + "vitest": "0.34.1" }, "publishConfig": { "access": "public", diff --git a/packages/core/README.md b/packages/core/README.md index 14b1eb640..0d7b6fd9b 100644 --- a/packages/core/README.md +++ b/packages/core/README.md @@ -1,3 +1,3 @@ # @rspress/core -The core pacakge for [Rspress](https://rspress.dev). +The core package for [Rspress](https://rspress.dev). diff --git a/packages/core/src/node/mdx/rehypePlugins/codeMeta.ts b/packages/core/src/node/mdx/rehypePlugins/codeMeta.ts index 5df94fceb..77229ccee 100644 --- a/packages/core/src/node/mdx/rehypePlugins/codeMeta.ts +++ b/packages/core/src/node/mdx/rehypePlugins/codeMeta.ts @@ -13,7 +13,7 @@ export const rehypePluginCodeMeta: Plugin<[], Root> = () => { node.children[0].tagName === 'code' ) { const codeNode = node.children[0]; - // language-xxx + // language-foo const meta = (codeNode.data?.meta as string) || ''; codeNode.properties.meta = meta; } diff --git a/packages/core/src/node/route/RouteService.ts b/packages/core/src/node/route/RouteService.ts index de3ab2862..6a7909389 100644 --- a/packages/core/src/node/route/RouteService.ts +++ b/packages/core/src/node/route/RouteService.ts @@ -280,7 +280,7 @@ ${routeMeta * route: '/', * element: jsx(Route0), * preload: Route0.preload, - * filePath: '/Users/xxx/xxx/index.md' + * filePath: '/Users/foo/bar/index.md' * } * * For client render, example: @@ -288,7 +288,7 @@ ${routeMeta * route: '/', * element: jsx(Route0.default), * preload: Route0.preload, - * filePath: '/Users/xxx/xxx/index.md' + * filePath: '/Users/foo/bar/index.md' * } */ return `{ path: '${route.routePath}', element: React.createElement(${component}), filePath: '${route.relativePath}', preload: ${preload}, lang: '${route.lang}', version: '${route.version}' }`; diff --git a/packages/core/src/node/runtimeModule/globalStyles.ts b/packages/core/src/node/runtimeModule/globalStyles.ts index 422346b82..1590efeac 100644 --- a/packages/core/src/node/runtimeModule/globalStyles.ts +++ b/packages/core/src/node/runtimeModule/globalStyles.ts @@ -10,7 +10,7 @@ export async function globalStylesVMPlugin(context: FactoryContext) { const source = config.globalStyles; const styleContent = await fs.readFile(source, 'utf-8'); - // Patch --modern-xxx, .modern-xxx global name + // Patch --modern-abc, .modern-abc global name const patchedStyleContent = styleContent .replace(/--modern-/g, '--rp-') .replace(/\.modern-doc/g, '.rspress') diff --git a/packages/core/src/node/runtimeModule/siteData/index.ts b/packages/core/src/node/runtimeModule/siteData/index.ts index 86e1bf594..6a58f85d2 100644 --- a/packages/core/src/node/runtimeModule/siteData/index.ts +++ b/packages/core/src/node/runtimeModule/siteData/index.ts @@ -9,7 +9,7 @@ import { TEMP_DIR, isProduction } from '@/node/constants'; // How can we let the client runtime access the `indexHash`? // We can only do something after the Rspack build process becuase the index hash is generated within Rspack build process.There are two ways to do this: -// 1. insert window.__INDEX_HASH__ = 'xxx' into the html template manually +// 1. insert window.__INDEX_HASH__ = 'foo' into the html template manually // 2. replace the `__INDEX_HASH__` placeholder in the html template with the real index hash after Rspack build export const indexHash = ''; diff --git a/packages/core/src/node/searchIndex.ts b/packages/core/src/node/searchIndex.ts index 9e9da8419..cc37e1fb1 100644 --- a/packages/core/src/node/searchIndex.ts +++ b/packages/core/src/node/searchIndex.ts @@ -12,7 +12,7 @@ export async function writeSearchIndex(config: UserConfig) { return; } const cwd = process.cwd(); - // get all search index files, format is `${SEARCH_INDEX_NAME}.xxx.${hash}.json` + // get all search index files, format is `${SEARCH_INDEX_NAME}.foo.${hash}.json` const searchIndexFiles = await fs.readdir(TEMP_DIR); const outDir = config?.outDir ?? join(cwd, OUTPUT_DIR); diff --git a/packages/document/docs/en/api/config/config-theme.mdx b/packages/document/docs/en/api/config/config-theme.mdx index e086854a4..2caf143f1 100644 --- a/packages/document/docs/en/api/config/config-theme.mdx +++ b/packages/document/docs/en/api/config/config-theme.mdx @@ -328,7 +328,7 @@ export default defineConfig({ { icon: 'wechat', mode: 'text', - content: 'wechat: xxx', + content: 'wechat: foo', }, { icon: 'qq', @@ -374,19 +374,17 @@ If you need to customize the icon, you can pass in an object with `svg attribute import { defineConfig } from 'rspress/config'; export default defineConfig({ - themeConfig: { - socialLinks: [ - { - icon: { - svg: 'xxx', - }, - mode: 'link', - content: 'https://github.com/', + themeConfig: { + socialLinks: [ + { + icon: { + svg: 'foo', }, - ], - }, - } - plugins: [docTools()],· + mode: 'link', + content: 'https://github.com/', + }, + ], + }, }); ``` diff --git a/packages/document/docs/en/plugin/system/plugin-api.mdx b/packages/document/docs/en/plugin/system/plugin-api.mdx index c0607710a..e4858c48c 100644 --- a/packages/document/docs/en/plugin/system/plugin-api.mdx +++ b/packages/document/docs/en/plugin/system/plugin-api.mdx @@ -50,7 +50,7 @@ import { RspressPlugin } from '@rspress/shared'; export function pluginForDoc(): RspressPlugin { // component path - const componentPath = path.join(__dirname, 'xxx.tsx'); + const componentPath = path.join(__dirname, 'foo.tsx'); return { // plugin name name: 'plugin-comp', @@ -68,7 +68,7 @@ import { RspressPlugin } from '@rspress/shared'; export function pluginForDoc(): RspressPlugin { // component path - const componentPath = path.join(__dirname, 'xxx.tsx'); + const componentPath = path.join(__dirname, 'foo.tsx'); return { // plugin name name: 'plugin-comp', @@ -364,17 +364,17 @@ export function pluginForDoc(): RspressPlugin { }; const data = await fetchSomeData(); return { - 'virtual-xxx': `export default ${JSON.stringify(data)}`, + 'virtual-foo': `export default ${JSON.stringify(data)}`, }; }, }; } ``` -In this way, you can use the `virtual-xxx` module in the runtime component: +In this way, you can use the `virtual-foo` module in the runtime component: ```jsx -import myData from 'virtual-xxx'; +import myData from 'virtual-foo'; export function MyComponent() { return
{myData.a}
; diff --git a/packages/document/docs/zh/api/config/config-theme.mdx b/packages/document/docs/zh/api/config/config-theme.mdx index 198081396..4359d7e4a 100644 --- a/packages/document/docs/zh/api/config/config-theme.mdx +++ b/packages/document/docs/zh/api/config/config-theme.mdx @@ -314,7 +314,7 @@ export default defineConfig({ { icon: 'wechat', mode: 'text', - content: '微信号xxx', + content: '微信号 foo', }, { icon: 'qq', @@ -354,7 +354,7 @@ export type SocialLinkIcon = | { svg: string }; ``` -如果需要自定义 icon,可以通过传入一个带有`svg属性`的对象,svg 的值为自定义图标内容即可,比如: +如果需要自定义 icon,可以通过传入一个带有 `svg 属性` 的对象,svg 的值为自定义图标内容即可,比如: ```js import { defineConfig } from 'rspress/config'; @@ -364,7 +364,7 @@ export default defineConfig({ socialLinks: [ { icon: { - svg: 'svg图标内容', + svg: 'foo', }, mode: 'link', content: 'https://github.com/', diff --git a/packages/document/docs/zh/plugin/system/plugin-api.mdx b/packages/document/docs/zh/plugin/system/plugin-api.mdx index 28f122b44..aa79ca84a 100644 --- a/packages/document/docs/zh/plugin/system/plugin-api.mdx +++ b/packages/document/docs/zh/plugin/system/plugin-api.mdx @@ -51,7 +51,7 @@ import { RspressPlugin } from '@rspress/shared'; export function pluginForDoc(): RspressPlugin { // 组件路径 - const componentPath = path.join(__dirname, 'xxx.tsx'); + const componentPath = path.join(__dirname, 'foo.tsx'); return { // 插件名称 name: 'plugin-comp', @@ -69,7 +69,7 @@ import { RspressPlugin } from '@rspress/shared'; export function pluginForDoc(): RspressPlugin { // component path - const componentPath = path.join(__dirname, 'xxx.tsx'); + const componentPath = path.join(__dirname, 'foo.tsx'); return { // plugin name name: 'plugin-comp', @@ -372,17 +372,17 @@ export function pluginForDoc(): RspressPlugin { }; const data = await fetchSomeData(); return { - 'virtual-xxx': `export default ${JSON.stringify(data)}`, + 'virtual-foo': `export default ${JSON.stringify(data)}`, }; }, }; } ``` -这样你就可以在运行时组件中使用 `virtual-xxx` 模块了: +这样你就可以在运行时组件中使用 `virtual-foo` 模块了: ```jsx -import myData from 'virtual-xxx'; +import myData from 'virtual-foo'; export function MyComponent() { return
{myData.a}
; diff --git a/packages/plugin-api-docgen/src/index.ts b/packages/plugin-api-docgen/src/index.ts index 14b747878..f17d96309 100644 --- a/packages/plugin-api-docgen/src/index.ts +++ b/packages/plugin-api-docgen/src/index.ts @@ -42,7 +42,7 @@ export function pluginApiDocgen(options?: PluginOptions): RspressPlugin { }); }, async modifySearchIndexData(pages) { - // Update the search index of module doc which includes `` and ` + // Update the search index of module doc which includes `` and ` const apiCompRegExp = /()|((.*)?<\/API>)/; await Promise.all( pages.map(async page => { diff --git a/packages/plugin-container-syntax/src/remarkPlugin.ts b/packages/plugin-container-syntax/src/remarkPlugin.ts index b57ae2817..f15a5704c 100644 --- a/packages/plugin-container-syntax/src/remarkPlugin.ts +++ b/packages/plugin-container-syntax/src/remarkPlugin.ts @@ -1,11 +1,11 @@ /** * 🚀 This plugin is used to support container directive in unified. * Taking into account the compatibility of the VuePress/Docusaurus container directive, current remark plugin in unified ecosystem only supports the following syntax: - * ::: tip {title="xxx"} + * ::: tip {title="foo"} * This is a tip * ::: * But the following syntax is not supported: - * ::: tip xxx + * ::: tip foo * This is a tip * ::: * In fact, the syntax is usually used in SSG Frameworks, such as VuePress/Docusaurus. @@ -52,7 +52,7 @@ const parseTitle = (rawTitle = '', isMDX = false) => { * Construct the DOM structure of the container directive. * For example: * - * ::: tip {title="xxx"} + * ::: tip {title="foo"} * This is a tip * ::: * @@ -137,19 +137,19 @@ function transformer(tree: Root) { continue; } const [, type, rawTitle] = match; - // In .md, we can get :::tip{title="xxx"} in the first text node - // In .mdx, we get :::tip in first node and {title="xxx"} in second node + // In .md, we can get :::tip{title="foo"} in the first text node + // In .mdx, we get :::tip in first node and {title="foo"} in second node let title = parseTitle(rawTitle); - // :::tip{title="xxx"} + // :::tip{title="foo"} const titleExpressionNode = // @ts-expect-error mdxTextExpression is not defined in mdast node.children[1] && node.children[1].type === 'mdxTextExpression' ? node.children[1] : null; - // Handle the case of `::: tip {title="xxx"}` + // Handle the case of `::: tip {title="foo"}` if (titleExpressionNode) { title = parseTitle((titleExpressionNode as Literal).value, true); - // {title="xxx"} is not a part of the content, So we need to remove it + // {title="foo"} is not a part of the content, So we need to remove it node.children.splice(1, 1); } if (!DIRECTIVE_TYPES.includes(type as DirectiveType)) { diff --git a/packages/plugin-container-syntax/tests/__snapshots__/index.test.ts.snap b/packages/plugin-container-syntax/tests/__snapshots__/index.test.ts.snap index bd51bddbf..a344b11e6 100644 --- a/packages/plugin-container-syntax/tests/__snapshots__/index.test.ts.snap +++ b/packages/plugin-container-syntax/tests/__snapshots__/index.test.ts.snap @@ -13,30 +13,30 @@ This is a tip

12312

" `; -exports[`remark-container > Use {title="xxx"} as title 1`] = `"
Cutsom title

This is a tip.

"`; +exports[`remark-container > Use {title="foo"} as title 1`] = `"
Custom title

This is a tip.

"`; -exports[`remark-container > Use {title='xxx'} as title 1`] = `"
Cutsom title

This is a tip.

"`; +exports[`remark-container > Use {title='foo'} as title 1`] = `"
Custom title

This is a tip.

"`; -exports[`remark-container > Use {title=xxx} as title 1`] = `"
Cutsom title

This is a tip.

"`; +exports[`remark-container > Use {title=foo} as title 1`] = `"
Custom title

This is a tip.

"`; exports[`remark-container > With a new line after the start position of container 1`] = `"
TIP

This is a tip

"`; exports[`remark-container > With block quote in container 1`] = ` -"
TIP

This is a tip with code and link some text

+"
TIP

This is a tip with code and link some text

This is a quote

" `; exports[`remark-container > With code block in container 1`] = ` -"
TIP

This is a tip with code and link some text

const a = 1;
+"
TIP

This is a tip with code and link some text

const a = 1;
 
" `; exports[`remark-container > With link, inlineCode, img, list in container 1`] = ` -"
TIP

This is a tip with code and link some text

    +"
    TIP

    This is a tip with code and link some text

    • list 1
    • list 2
    • -

    \\"img\\"

    " +

\\"img\\"

" `; exports[`remark-container > With new line before the end position of container 1`] = ` diff --git a/packages/plugin-container-syntax/tests/index.test.ts b/packages/plugin-container-syntax/tests/index.test.ts index 7a3ddd1c3..91ae1cca3 100644 --- a/packages/plugin-container-syntax/tests/index.test.ts +++ b/packages/plugin-container-syntax/tests/index.test.ts @@ -54,7 +54,7 @@ describe('remark-container', () => { const result = processor.processSync(` :::tip - This is a tip with \`code\` and [link](xxx) some text + This is a tip with \`code\` and [link](foo) some text \`\`\`js const a = 1; @@ -68,7 +68,7 @@ describe('remark-container', () => { const result = processor.processSync(` :::tip - This is a tip with \`code\` and [link](xxx) some text + This is a tip with \`code\` and [link](foo) some text > This is a quote @@ -80,12 +80,12 @@ describe('remark-container', () => { const result = processor.processSync(` :::tip - This is a tip with \`code\` and [link](xxx) some text + This is a tip with \`code\` and [link](foo) some text - list 1 - list 2 - ![img](xxx) + ![img](foo) :::`); expect(result.value).toMatchSnapshot(); @@ -101,9 +101,9 @@ describe('remark-container', () => { expect(result.value).toMatchSnapshot(); }); - test('Use {title="xxx"} as title', () => { + test('Use {title="foo"} as title', () => { const result = processor.processSync(` - ::: tip{title="Cutsom title"} + ::: tip{title="Custom title"} This is a tip. @@ -111,9 +111,9 @@ describe('remark-container', () => { expect(result.value).toMatchSnapshot(); }); - test("Use {title='xxx'} as title", () => { + test("Use {title='foo'} as title", () => { const result = processor.processSync(` -::: tip{title='Cutsom title'} +::: tip{title='Custom title'} This is a tip. @@ -121,9 +121,9 @@ This is a tip. expect(result.value).toMatchSnapshot(); }); - test('Use {title=xxx} as title', () => { + test('Use {title=foo} as title', () => { const result = processor.processSync(` -::: tip{title=Cutsom title} +::: tip{title=Custom title} This is a tip. diff --git a/packages/plugin-playground/src/cli/remarkPlugin.ts b/packages/plugin-playground/src/cli/remarkPlugin.ts index 615c5c6f6..f2466f7f9 100644 --- a/packages/plugin-playground/src/cli/remarkPlugin.ts +++ b/packages/plugin-playground/src/cli/remarkPlugin.ts @@ -46,7 +46,7 @@ export const remarkPlugin: Plugin<[RemarkPluginProps], Root> = ({ return; } - // 1. External demo , use to declare demo + // 1. External demo , use to declare demo visit(tree, 'mdxJsxFlowElement', (node: any) => { if (node.name === 'code') { const src = getNodeAttribute(node, 'src'); diff --git a/packages/plugin-playground/src/web/runner.tsx b/packages/plugin-playground/src/web/runner.tsx index 33cdd07f2..f19a2422a 100644 --- a/packages/plugin-playground/src/web/runner.tsx +++ b/packages/plugin-playground/src/web/runner.tsx @@ -87,7 +87,7 @@ class Runner extends Component { if (specifier.local.name === 'React') { this.hasReactImported = true; } - // import X from 'xxx' + // import X from 'foo' if (specifier.type === 'ImportDefaultSpecifier') { // const ${specifier.local.name} = __get_import() code.push( @@ -97,7 +97,7 @@ class Runner extends Component { ), ); } - // import * as X from 'xxx' + // import * as X from 'foo' if (specifier.type === 'ImportNamespaceSpecifier') { // const ${specifier.local.name} = __get_import() code.push( @@ -107,7 +107,7 @@ class Runner extends Component { ), ); } - // import { a, b, c } from 'xxx' + // import { a, b, c } from 'foo' if (specifier.type === 'ImportSpecifier') { if ( 'name' in specifier.imported && diff --git a/packages/plugin-preview/src/remarkPlugin.ts b/packages/plugin-preview/src/remarkPlugin.ts index 41d009109..72eb3c691 100644 --- a/packages/plugin-preview/src/remarkPlugin.ts +++ b/packages/plugin-preview/src/remarkPlugin.ts @@ -66,7 +66,7 @@ export const remarkCodeToDemo: Plugin<[RemarkPluginOptions], Root> = function ({ // get external demo content const tempVar = `externalDemoContent${externalDemoIndex}`; if (externalDemoIndex !== undefined) { - // Such as `import externalDemoContent0 from '!!xxx?raw'` + // Such as `import externalDemoContent0 from '!!foo?raw'` // `!!` prefix is used to avoid other loaders in rspack demoMdx.push(getASTNodeImport(tempVar, `!!${demoPath}?raw`)); } @@ -120,7 +120,7 @@ export const remarkCodeToDemo: Plugin<[RemarkPluginOptions], Root> = function ({ } }); - // 1. External demo , use to declare demo + // 1. External demo , use to declare demo visit(tree, 'mdxJsxFlowElement', (node: any) => { if (node.name === 'code') { const src = node.attributes.find( diff --git a/packages/plugin-typedoc/src/sidebar.ts b/packages/plugin-typedoc/src/sidebar.ts index ffada7b68..2313300f8 100644 --- a/packages/plugin-typedoc/src/sidebar.ts +++ b/packages/plugin-typedoc/src/sidebar.ts @@ -20,10 +20,10 @@ interface ModuleItem { async function patchLinks(outputDir: string) { // Patch links in markdown files // Scan all the markdown files in the output directory - // replace [xxx](yyy) -> [xxx](./yyy) + // replace [foo](bar) -> [foo](./bar) const normlizeLinksInFile = async (filePath: string) => { const content = await fs.readFile(filePath, 'utf-8'); - // replace: [xxx](yyy) -> [xxx](./yyy) + // replace: [foo](bar) -> [foo](./bar) const newContent = content.replace( /\[([^\]]+)\]\(([^)]+)\)/g, (_match, p1, p2) => { diff --git a/packages/shared/src/runtime-utils/index.test.ts b/packages/shared/src/runtime-utils/index.test.ts index 471e1b47c..779840163 100644 --- a/packages/shared/src/runtime-utils/index.test.ts +++ b/packages/shared/src/runtime-utils/index.test.ts @@ -50,8 +50,8 @@ describe('test shared utils', () => { expect(normalizeHref('/guide')).toBe('/guide.html'); expect(normalizeHref('/guide/index.html')).toBe('/guide/index.html'); expect(normalizeHref('/guide/index')).toBe('/guide/index.html'); - expect(normalizeHref('https://example.com/xxx')).toBe( - 'https://example.com/xxx', + expect(normalizeHref('https://example.com/foo')).toBe( + 'https://example.com/foo', ); expect(normalizeHref('mailto:bluth@example.com')).toBe( 'mailto:bluth@example.com', diff --git a/packages/theme-default/src/components/Search/SuggestItem.tsx b/packages/theme-default/src/components/Search/SuggestItem.tsx index dd0fdbf3f..83a122990 100644 --- a/packages/theme-default/src/components/Search/SuggestItem.tsx +++ b/packages/theme-default/src/components/Search/SuggestItem.tsx @@ -47,14 +47,14 @@ export function SuggestItem({ // Split raw text into several parts, and add styles.mark className to the parts that need to be highlighted. // highlightInfoList is an array of objects, each object contains the start index and the length of the part that needs to be highlighted. // For example, if the statement is "This is a statement", and the query is "is", then highlightInfoList is [{start: 2, length: 2}, {start: 5, length: 2}]. - const framegmentList = []; + const fragmentList = []; let lastIndex = 0; for (const highlightInfo of highlights) { const { start, length } = highlightInfo; const prefix = rawText.slice(lastIndex, start); const queryStr = getSlicedStrByByteLength(rawText, start, length); - framegmentList.push(prefix); - framegmentList.push( + fragmentList.push(prefix); + fragmentList.push( {queryStr} , @@ -63,10 +63,10 @@ export function SuggestItem({ } if (lastIndex < rawText.length) { - framegmentList.push(rawText.slice(lastIndex)); + fragmentList.push(rawText.slice(lastIndex)); } - return framegmentList; + return fragmentList; }; const renderHeaderMatch = () => { diff --git a/packages/theme-default/src/layout/DocLayout/docComponents/hr.tsx b/packages/theme-default/src/layout/DocLayout/docComponents/hr.tsx index f26991fc0..37f4a1213 100644 --- a/packages/theme-default/src/layout/DocLayout/docComponents/hr.tsx +++ b/packages/theme-default/src/layout/DocLayout/docComponents/hr.tsx @@ -4,7 +4,7 @@ export const Hr = (props: ComponentProps<'hr'>) => { return (
); }; diff --git a/packages/theme-default/src/logic/useUISwitch.ts b/packages/theme-default/src/logic/useUISwitch.ts index e1c2174a7..592a4b3e6 100644 --- a/packages/theme-default/src/logic/useUISwitch.ts +++ b/packages/theme-default/src/logic/useUISwitch.ts @@ -38,7 +38,7 @@ export function useUISwitch(): UISwitchResult { ); const sidebar = localesData.sidebar || {}; - // siderbar Priority + // sidebar Priority // 1. frontmatter.sidebar // 2. themeConfig.locales.sidebar // 3. themeConfig.sidebar diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 702368fd6..f0789e427 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -41,6 +41,9 @@ importers: cross-spawn: specifier: ^7.0.3 version: 7.0.3 + cspell-ban-words: + specifier: ^0.0.3 + version: 0.0.3 execa: specifier: 8.0.1 version: 8.0.1 @@ -5358,6 +5361,10 @@ packages: resolution: {integrity: sha512-mCxBlsHFYh9C+HVpiEacem8FEBnMXgU9gy4zmNC+SXAZNB/1idgp/aulFJ4FgCi7GPEVbfyng092GqL2k2rmow==} dev: true + /cspell-ban-words@0.0.3: + resolution: {integrity: sha512-Q7ZO16DFWEP8Vv5CJ63LG95/FomTuxB6WvKhvGUDE3L2hiYl7n2fH+0qoSXL5C3zH6NRPQT4rDS66t1Pi/fILA==} + dev: true + /cssesc@3.0.0: resolution: {integrity: sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg==} engines: {node: '>=4'} diff --git a/scripts/dictionary.txt b/scripts/dictionary.txt new file mode 100644 index 000000000..3da4d3b49 --- /dev/null +++ b/scripts/dictionary.txt @@ -0,0 +1,117 @@ +# Custom Dictionary Words +antd +apng +applescript +atrules +bilibili +biomejs +brotli +browserslistrc +bundleless +caniuse +chunkhash +Chunktmp +classname +compat +consolas +contentful +corejs +corepack +craco +crossorigin +datauri +deepmerge +docgen +envinfo +estree +facti +flac +flexbox +flexbugs +fnames +frontmatter +fullhash +htmr +iconify +icss +idents +iife +imagex +jfif +jiti +jscpuprofile +jsesc +juejin +koppers +lightningcss +longpaths +manypkg +mattcompiles +menlo +modularly +napi +nextra +nolyfill +nprogress +ntqry +onclosetag +onopentag +ontext +osascript +outro +pageerror +pathinfo +perfetto +picocolors +pjpeg +pluggable +pmmmwh +postcssrc +preact +prebundle +preflights +prefresh +preprocessors +pxtorem +rebranded +rehype +rsbuild +rsdoctor +rsfamily +rslog +rspack +rspress +selfsign +shiki +sirv +sokra +speedscope +srcset +stacktracey +styl +subdir +subpage +subresource +svgr +swcrc +systemjs +tailwindcss +templating +transpiling +treeshaking +tsbuildinfo +tsdoc +unocss +unpatch +unplugin +unshift +upath +vitest +watchpack +webm +webp +wechat +weibo +weixin +zeabur +zhihu