Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: web-infra-dev/rspress
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v2.0.0-alpha.2
Choose a base ref
...
head repository: web-infra-dev/rspress
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v2.0.0-alpha.3
Choose a head ref
  • 16 commits
  • 47 files changed
  • 6 contributors

Commits on Mar 12, 2025

  1. chore(deps): update dependency react-helmet-async to v2 (#1801)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Mar 12, 2025
    Copy the full SHA
    702d6fc View commit details
  2. chore(deps): update dependency qrcode.react to v4 (#1786)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Mar 12, 2025
    Copy the full SHA
    5dca98b View commit details

Commits on Mar 13, 2025

  1. fix(deps): update react-helmet-async 2.0.0 (#1951)

    SoonIter authored Mar 13, 2025
    Copy the full SHA
    c3c6ad3 View commit details
  2. feat: enable search.codeBlocks by default (#1952)

    Co-authored-by: Timeless0911 <50201324+Timeless0911@users.noreply.github.com>
    chenjiahan and Timeless0911 authored Mar 13, 2025
    Copy the full SHA
    564678b View commit details
  3. fix(deps): update react-helmet-async 2.0.0(#1951) (#1953)

    SoonIter authored Mar 13, 2025
    Copy the full SHA
    2db3548 View commit details
  4. chore(deps): update typescript 5.8.2 (#1954)

    SoonIter authored Mar 13, 2025
    Copy the full SHA
    58d9406 View commit details

Commits on Mar 14, 2025

  1. fix: improve reported responsive issues (#1956)

    JounQin authored Mar 14, 2025
    Copy the full SHA
    3229281 View commit details
  2. docs: update i18n messages (#1958)

    chenjiahan authored Mar 14, 2025
    Copy the full SHA
    d844a7c View commit details

Commits on Mar 15, 2025

  1. fix: overview page overflow (#1960)

    JounQin authored Mar 15, 2025
    Copy the full SHA
    bca6c8a View commit details

Commits on Mar 17, 2025

  1. chore(deps): update all patch dependencies (#1962)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Mar 17, 2025
    Copy the full SHA
    ba3c633 View commit details
  2. chore(deps): update dependency @microsoft/api-extractor to ^7.52.1 (#…

    …1963)
    
    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Mar 17, 2025
    Copy the full SHA
    1ca7cf5 View commit details
  3. feat(style): add link icon for external links (#1964)

    chenjiahan authored Mar 17, 2025
    Copy the full SHA
    1261a82 View commit details
  4. fix(style): unset the navItem bg color (#1966)

    SoonIter authored Mar 17, 2025
    Copy the full SHA
    f6a9381 View commit details
  5. fix: update search placeholder text to 'Search' (#1965)

    chenjiahan authored Mar 17, 2025
    Copy the full SHA
    5f3cc34 View commit details
  6. docs: add editLink and outline config (#1969)

    9aoy authored Mar 17, 2025
    Copy the full SHA
    759d12a View commit details

Commits on Mar 18, 2025

  1. Release v2.0.0-alpha.3 (#1972)

    SoonIter authored Mar 18, 2025
    Copy the full SHA
    0413e23 View commit details
Showing with 791 additions and 700 deletions.
  1. +5 −0 .changeset/1742268020817-alpha-release.md
  2. +4 −0 .github/workflows/test-Windows.yml
  3. +4 −0 .github/workflows/test-macOS.yml
  4. +1 −1 e2e/fixtures/modern-js/package.json
  5. +0 −3 e2e/fixtures/search-code-blocks/rspress.config.ts
  6. +5 −5 packages/cli/package.json
  7. +6 −6 packages/core/package.json
  8. +2 −2 packages/core/src/node/build.ts
  9. +1 −1 packages/core/src/node/runtimeModule/siteData/index.ts
  10. +4 −4 packages/create-rspress/package.json
  11. +3 −3 packages/document/docs/en/api/config/config-basic.mdx
  12. +63 −4 packages/document/docs/en/api/config/config-theme.mdx
  13. +3 −3 packages/document/docs/zh/api/config/config-basic.mdx
  14. +63 −4 packages/document/docs/zh/api/config/config-theme.mdx
  15. +4 −16 packages/document/i18n.json
  16. +2 −2 packages/document/package.json
  17. +0 −4 packages/document/rspress.config.ts
  18. +4 −4 packages/modern-plugin-rspress/package.json
  19. +7 −7 packages/plugin-algolia/package.json
  20. +6 −0 packages/plugin-algolia/src/runtime/Search.css
  21. +6 −6 packages/plugin-api-docgen/package.json
  22. +4 −4 packages/plugin-auto-nav-sidebar/package.json
  23. +5 −5 packages/plugin-client-redirects/package.json
  24. +3 −3 packages/plugin-container-syntax/package.json
  25. +4 −4 packages/plugin-last-updated/package.json
  26. +5 −5 packages/plugin-medium-zoom/package.json
  27. +5 −5 packages/plugin-playground/package.json
  28. +6 −6 packages/plugin-preview/package.json
  29. +1 −5 packages/plugin-preview/static/global-styles/iframe.css
  30. +4 −4 packages/plugin-rss/package.json
  31. +4 −4 packages/plugin-shiki/package.json
  32. +5 −5 packages/plugin-typedoc/package.json
  33. +4 −4 packages/runtime/package.json
  34. +4 −4 packages/shared/package.json
  35. +5 −5 packages/theme-default/package.json
  36. +1 −2 packages/theme-default/src/components/Nav/NavMenuSingleItem.tsx
  37. +14 −1 packages/theme-default/src/components/Nav/index.module.scss
  38. +7 −11 packages/theme-default/src/components/Nav/index.tsx
  39. +1 −1 packages/theme-default/src/components/Search/SearchButton.tsx
  40. +1 −1 packages/theme-default/src/components/Search/SearchPanel.tsx
  41. +5 −2 packages/theme-default/src/components/SidebarMenu/index.scss
  42. +55 −48 packages/theme-default/src/components/SidebarMenu/index.tsx
  43. +18 −0 packages/theme-default/src/layout/DocLayout/docComponents/index.module.scss
  44. +15 −5 packages/theme-default/src/layout/DocLayout/index.module.scss
  45. +10 −15 packages/theme-default/src/layout/DocLayout/index.tsx
  46. +411 −475 pnpm-lock.yaml
  47. +1 −1 scripts/config/package.json
5 changes: 5 additions & 0 deletions .changeset/1742268020817-alpha-release.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@rspress/core': alpha
---

Release version 2.0.0-alpha.3
4 changes: 4 additions & 0 deletions .github/workflows/test-Windows.yml
Original file line number Diff line number Diff line change
@@ -74,6 +74,10 @@ jobs:
if: ${{steps.skip-ci.outputs.RESULT != 'true'}}
run: pnpm run build

- name: Build Website # for test
if: ${{steps.skip-ci.outputs.RESULT != 'true'}}
run: pnpm run build:website

- name: Unit Test
if: ${{steps.skip-ci.outputs.RESULT != 'true'}}
run: pnpm run test:unit
4 changes: 4 additions & 0 deletions .github/workflows/test-macOS.yml
Original file line number Diff line number Diff line change
@@ -68,6 +68,10 @@ jobs:
if: ${{steps.skip-ci.outputs.RESULT != 'true'}}
run: pnpm run build

- name: Build Website # for test
if: ${{steps.skip-ci.outputs.RESULT != 'true'}}
run: pnpm run build:website

- name: Unit Test
if: ${{steps.skip-ci.outputs.RESULT != 'true'}}
run: pnpm run test:unit
2 changes: 1 addition & 1 deletion e2e/fixtures/modern-js/package.json
Original file line number Diff line number Diff line change
@@ -33,6 +33,6 @@
"@types/react": "^18.3.18",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"typescript": "^5.5.3"
"typescript": "^5.8.2"
}
}
3 changes: 0 additions & 3 deletions e2e/fixtures/search-code-blocks/rspress.config.ts
Original file line number Diff line number Diff line change
@@ -3,7 +3,4 @@ import { defineConfig } from 'rspress/config';

export default defineConfig({
root: path.join(__dirname, 'doc'),
search: {
codeBlocks: true,
},
});
10 changes: 5 additions & 5 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rspress",
"version": "2.0.0-alpha.2",
"version": "2.0.0-alpha.3",
"repository": {
"type": "git",
"url": "https://github.com/web-infra-dev/rspress",
@@ -41,21 +41,21 @@
"reset": "rimraf ./**/node_modules"
},
"dependencies": {
"@rsbuild/core": "1.2.16",
"@rsbuild/core": "1.2.19",
"@rspress/core": "workspace:*",
"@rspress/shared": "workspace:*",
"cac": "^6.7.14",
"chokidar": "^3.6.0",
"picocolors": "^1.1.1"
},
"devDependencies": {
"@microsoft/api-extractor": "^7.51.1",
"@rslib/core": "0.5.3",
"@microsoft/api-extractor": "^7.52.1",
"@rslib/core": "0.5.4",
"@types/jest": "~29.5.14",
"@types/node": "^18.11.17",
"@types/react": "^18.3.18",
"rimraf": "^6.0.1",
"typescript": "^5.5.3"
"typescript": "^5.8.2"
},
"publishConfig": {
"access": "public",
12 changes: 6 additions & 6 deletions packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@rspress/core",
"version": "2.0.0-alpha.2",
"version": "2.0.0-alpha.3",
"description": "The Rspress Documentation Framework",
"bugs": "https://github.com/web-infra-dev/rspress/issues",
"repository": {
@@ -50,7 +50,7 @@
"@mdx-js/loader": "2.3.0",
"@mdx-js/mdx": "2.3.0",
"@mdx-js/react": "2.3.0",
"@rsbuild/core": "1.2.16",
"@rsbuild/core": "1.2.19",
"@rsbuild/plugin-react": "~1.1.1",
"@rspress/mdx-rs": "0.6.6",
"@rspress/plugin-auto-nav-sidebar": "workspace:*",
@@ -71,7 +71,7 @@
"picocolors": "^1.1.1",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-helmet-async": "^1.3.0",
"react-helmet-async": "^2.0.5",
"react-lazy-with-preload": "^2.2.1",
"react-syntax-highlighter": "^15.6.1",
"rehype-external-links": "^3.0.0",
@@ -84,8 +84,8 @@
"unist-util-visit-children": "^2.0.2"
},
"devDependencies": {
"@microsoft/api-extractor": "^7.51.1",
"@rslib/core": "0.5.3",
"@microsoft/api-extractor": "^7.52.1",
"@rslib/core": "0.5.4",
"@rspress-dev/plugin-preview": "link:../plugin-preview",
"@rspress/config": "workspace:*",
"@types/hast": "^2.3.10",
@@ -103,7 +103,7 @@
"remark-rehype": "^10.1.0",
"rimraf": "^6.0.1",
"tailwindcss": "^3.4.17",
"typescript": "^5.5.3"
"typescript": "^5.8.2"
},
"engines": {
"node": ">=14.17.6"
4 changes: 2 additions & 2 deletions packages/core/src/node/build.ts
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@ import {
} from '@rspress/shared';
import { logger } from '@rspress/shared/logger';
import picocolors from 'picocolors';
import { HelmetData } from 'react-helmet-async';
import { default as ReactHelmetAsync } from 'react-helmet-async';
import { version } from '../../package.json';
import { PluginDriver } from './PluginDriver';
import {
@@ -138,7 +138,7 @@ export async function renderPages(
return !route.routePath.includes(':');
})
.map(async route => {
const helmetContext = new HelmetData({});
const helmetContext = new ReactHelmetAsync.HelmetData({});
const { routePath } = route;
let appHtml = '';
if (render) {
2 changes: 1 addition & 1 deletion packages/core/src/node/runtimeModule/siteData/index.ts
Original file line number Diff line number Diff line change
@@ -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,
8 changes: 4 additions & 4 deletions packages/create-rspress/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "create-rspress",
"version": "2.0.0-alpha.2",
"version": "2.0.0-alpha.3",
"description": "Create a new Rspress project",
"homepage": "https://rspress.dev",
"repository": {
@@ -31,10 +31,10 @@
"create-rstack": "1.2.0"
},
"devDependencies": {
"@microsoft/api-extractor": "^7.51.1",
"@rslib/core": "0.5.3",
"@microsoft/api-extractor": "^7.52.1",
"@rslib/core": "0.5.4",
"@types/node": "^18.11.17",
"typescript": "^5.5.3"
"typescript": "^5.8.2"
},
"engines": {
"node": ">=16.7.0"
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
@@ -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,
},
});
```
67 changes: 63 additions & 4 deletions packages/document/docs/en/api/config/config-theme.mdx
Original file line number Diff line number Diff line change
@@ -218,6 +218,25 @@ export default defineConfig({
});
```

## outline

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

Whether to show the sidebar in right position.

For example:

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

export default defineConfig({
themeConfig: {
outline: false,
},
});
```

## outlineTitle

- Type: `string`
@@ -299,7 +318,7 @@ export default defineConfig({
## searchPlaceholderText

- Type: `string`
- Default: `Search Docs`
- Default: `Search`

The placeholder text of the search box. For example:

@@ -308,7 +327,7 @@ import { defineConfig } from 'rspress/config';

export default defineConfig({
themeConfig: {
searchPlaceholderText: 'Search Docs',
searchPlaceholderText: 'Search',
},
});
```
@@ -509,8 +528,6 @@ export interface LocaleConfig {
*/
// Right outline title
outlineTitle?: string;
// Whether to display the outline title
outline?: boolean;
// Whether to display the last update time
lastUpdated?: boolean;
// Last update time text
@@ -525,6 +542,8 @@ export interface LocaleConfig {
searchNoResultsText?: string;
// The text of suggested query text when no search result
searchSuggestedQueryText?: string;
// Info for the edit link.
editLink?: EditLink;
}
```

@@ -586,6 +605,46 @@ export default defineConfig({
});
```

## editLink

- Type:

```ts
interface EditLink {
/**
* Custom repository url for edit link.
*/
docRepoBaseUrl: string;

/**
* Custom text for edit link.
*
* @default 'Edit this page'
*/
text?: string;
}
```

- Default: `undefined`

Display a link to edit the page on Git management services such as GitHub, or GitLab.

For example:

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

export default defineConfig({
themeConfig: {
editLink: {
docRepoBaseUrl:
'https://github.com/web-infra-dev/rspress/tree/main/packages/document/docs',
text: '📝 Edit this page on GitHub',
},
},
});
```

## enableContentAnimation

- Type: `boolean`
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
@@ -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,
},
});
```
67 changes: 63 additions & 4 deletions packages/document/docs/zh/api/config/config-theme.mdx
Original file line number Diff line number Diff line change
@@ -204,6 +204,25 @@ export default defineConfig({
});
```

## outline

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

是否显示右侧大纲。

比如:

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

export default defineConfig({
themeConfig: {
outline: false,
},
});
```

## outlineTitle

- Type: `string`
@@ -285,7 +304,7 @@ export default defineConfig({
## searchPlaceholderText

- Type: `string`
- Default: `Search Docs`
- Default: `Search`

搜索框的占位符文本。比如:

@@ -294,7 +313,7 @@ import { defineConfig } from 'rspress/config';

export default defineConfig({
themeConfig: {
searchPlaceholderText: 'Search Docs',
searchPlaceholderText: 'Search',
},
});
```
@@ -495,8 +514,6 @@ export interface LocaleConfig {
*/
// 右侧大纲标题
outlineTitle?: string;
// 是否显示右侧大纲
outline?: boolean;
// 最后更新时间文本
lastUpdatedText?: string;
// 是否显示最后更新时间
@@ -511,6 +528,8 @@ export interface LocaleConfig {
searchNoResultsText?: string;
// 没有搜索结果时的建议查询提示文本
searchSuggestedQueryText?: string;
// 配置编辑链接
editLink?: EditLink;
}
```

@@ -572,6 +591,46 @@ export default defineConfig({
});
```

## editLink

- Type:

```ts
interface EditLink {
/**
* 自定义编辑链接的 URL
*/
docRepoBaseUrl: string;

/**
* 自定义编辑链接的文本
*
* @default 'Edit this page'
*/
text?: string;
}
```

- Default: `undefined`

用于配置编辑链接,以在 GitHub 或 GitLab 等 Git 管理服务上编辑页面。

比如:

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

export default defineConfig({
themeConfig: {
editLink: {
docRepoBaseUrl:
'https://github.com/web-infra-dev/rspress/tree/main/packages/document/docs',
text: '📝 在 GitHub 上编辑此页',
},
},
});
```

## enableContentAnimation

- Type: `boolean`
20 changes: 4 additions & 16 deletions packages/document/i18n.json
Original file line number Diff line number Diff line change
@@ -55,24 +55,12 @@
"zh": "社区插件",
"en": "Community Plugins"
},
"start": {
"zh": "冷启动(Start)",
"en": "Code Start"
},
"hmr": {
"zh": "热更新",
"en": "HMR"
},
"build": {
"zh": "冷构建(Build)",
"en": "Code Build"
},
"toolStackTitle": {
"zh": "工具栈",
"en": "Tool Stack"
"zh": "Rstack",
"en": "Rstack"
},
"toolStackDesc": {
"zh": "围绕 Rspack 打造的高性能工具栈,助力现代 Web 开发",
"en": "High-performance tool stack built around Rspack to boost modern web development"
"zh": "围绕 Rspack 打造的高性能工具链,助力现代 Web 开发",
"en": "High-performance toolchain built around Rspack to boost modern web development"
}
}
4 changes: 2 additions & 2 deletions packages/document/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@rspress/docs",
"version": "2.0.0-alpha.2",
"version": "2.0.0-alpha.3",
"repository": {
"type": "git",
"url": "https://github.com/web-infra-dev/rspress",
@@ -26,7 +26,7 @@
"rspress": "workspace:*",
"rspress-plugin-font-open-sans": "^1.0.0",
"rspress-plugin-sitemap": "^1.1.1",
"typescript": "^5.5.3"
"typescript": "^5.8.2"
},
"publishConfig": {
"access": "public",
4 changes: 0 additions & 4 deletions packages/document/rspress.config.ts
Original file line number Diff line number Diff line change
@@ -57,7 +57,6 @@ export default defineConfig({
exclude: ['**/fragments/**'],
},
themeConfig: {
enableContentAnimation: true,
enableAppearanceAnimation: false,
footer: {
message: '© 2024 Bytedance Inc. All Rights Reserved.',
@@ -89,9 +88,6 @@ export default defineConfig({
'https://github.com/web-infra-dev/rspress/tree/main/packages/document/docs',
text: '📝 在 GitHub 上编辑此页',
},
searchNoResultsText: '未搜索到相关结果',
searchPlaceholderText: '搜索文档',
searchSuggestedQueryText: '可更换不同的关键字后重试',
overview: {
filterNameText: '过滤',
filterPlaceholderText: '输入关键词',
8 changes: 4 additions & 4 deletions packages/modern-plugin-rspress/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@rspress/modern-js-plugin",
"version": "2.0.0-alpha.2",
"version": "2.0.0-alpha.3",
"description": "A Modern.js plugin to integrate rspress",
"keywords": [
"react",
@@ -33,15 +33,15 @@
"tinyglobby": "^0.2.12"
},
"devDependencies": {
"@microsoft/api-extractor": "^7.51.1",
"@microsoft/api-extractor": "^7.52.1",
"@modern-js/module-tools": "2.64.0",
"@rslib/core": "0.5.3",
"@rslib/core": "0.5.4",
"@types/lodash": "^4.17.16",
"@types/node": "^18.11.17",
"@types/react": "^18.3.18",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"typescript": "^5.5.3"
"typescript": "^5.8.2"
},
"publishConfig": {
"access": "public",
14 changes: 7 additions & 7 deletions packages/plugin-algolia/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@rspress/plugin-algolia",
"version": "2.0.0-alpha.2",
"version": "2.0.0-alpha.3",
"description": "A plugin for rspress to search with algolia in docs.",
"bugs": "https://github.com/web-infra-dev/rspress/issues",
"repository": {
@@ -43,23 +43,23 @@
"@docsearch/react": "^3.9.0",
"algoliasearch": "^5.20.3",
"instantsearch.css": "^8.5.1",
"instantsearch.js": "^4.77.3",
"react-instantsearch": "^7.15.3"
"instantsearch.js": "^4.78.0",
"react-instantsearch": "^7.15.4"
},
"devDependencies": {
"@microsoft/api-extractor": "^7.51.1",
"@microsoft/api-extractor": "^7.52.1",
"@rsbuild/plugin-react": "~1.1.1",
"@rslib/core": "0.5.3",
"@rslib/core": "0.5.4",
"@rspress/config": "workspace:*",
"@rspress/shared": "workspace:*",
"@types/node": "^18.11.17",
"@types/react": "^18.3.18",
"@types/react-dom": "^18.3.5",
"react": "^18.3.1",
"typescript": "^5.5.3"
"typescript": "^5.8.2"
},
"peerDependencies": {
"@rspress/runtime": "workspace:^2.0.0-alpha.2"
"@rspress/runtime": "workspace:^2.0.0-alpha.3"
},
"engines": {
"node": ">=14.17.6"
6 changes: 6 additions & 0 deletions packages/plugin-algolia/src/runtime/Search.css
Original file line number Diff line number Diff line change
@@ -3,6 +3,12 @@
--docsearch-searchbox-background: var(--rp-c-bg-mute);
}

@media (max-width: 768px) {
.DocSearch {
--docsearch-searchbox-background: transparent;
}
}

.DocSearch-Button-Container > .DocSearch-Button-Placeholder {
font-size: 0.825rem;
}
12 changes: 6 additions & 6 deletions packages/plugin-api-docgen/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@rspress/plugin-api-docgen",
"version": "2.0.0-alpha.2",
"version": "2.0.0-alpha.3",
"description": "A plugin for rspress to generate api doc.",
"bugs": "https://github.com/web-infra-dev/rspress/issues",
"repository": {
@@ -31,24 +31,24 @@
"remark-gfm": "3.0.1"
},
"devDependencies": {
"@microsoft/api-extractor": "^7.51.1",
"@rslib/core": "0.5.3",
"@microsoft/api-extractor": "^7.52.1",
"@rslib/core": "0.5.4",
"@types/mdast": "^3.0.15",
"@types/node": "^18.11.17",
"@types/react": "^18.3.18",
"@types/react-dom": "^18.3.5",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-router-dom": "^6.29.0",
"typescript": "^5.5.3",
"typescript": "^5.8.2",
"unified": "^10.1.2",
"unist-util-visit": "^4.1.2"
},
"peerDependencies": {
"@rspress/core": "workspace:^2.0.0-alpha.2",
"@rspress/core": "workspace:^2.0.0-alpha.3",
"react": ">=17.0.0",
"react-router-dom": "^6.8.1",
"typescript": "^5.5.3"
"typescript": "^5.8.2"
},
"peerDependenciesMeta": {
"typescript": {
8 changes: 4 additions & 4 deletions packages/plugin-auto-nav-sidebar/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@rspress/plugin-auto-nav-sidebar",
"version": "2.0.0-alpha.2",
"version": "2.0.0-alpha.3",
"description": "A plugin for rspress to generate navbar and sidebar config automatically.",
"bugs": "https://github.com/web-infra-dev/rspress/issues",
"repository": {
@@ -31,14 +31,14 @@
"@rspress/shared": "workspace:*"
},
"devDependencies": {
"@microsoft/api-extractor": "^7.51.1",
"@rslib/core": "0.5.3",
"@microsoft/api-extractor": "^7.52.1",
"@rslib/core": "0.5.4",
"@rspress/config": "workspace:*",
"@types/node": "^18.11.17",
"@types/react": "^18.3.18",
"@types/react-dom": "^18.3.5",
"react": "^18.3.1",
"typescript": "^5.5.3"
"typescript": "^5.8.2"
},
"engines": {
"node": ">=14.17.6"
10 changes: 5 additions & 5 deletions packages/plugin-client-redirects/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@rspress/plugin-client-redirects",
"version": "2.0.0-alpha.2",
"version": "2.0.0-alpha.3",
"description": "A plugin for rspress to client redirect in docs.",
"bugs": "https://github.com/web-infra-dev/rspress/issues",
"repository": {
@@ -32,17 +32,17 @@
"@rspress/shared": "workspace:*"
},
"devDependencies": {
"@microsoft/api-extractor": "^7.51.1",
"@rslib/core": "0.5.3",
"@microsoft/api-extractor": "^7.52.1",
"@rslib/core": "0.5.4",
"@rspress/config": "workspace:*",
"@types/node": "^18.11.17",
"@types/react": "^18.3.18",
"@types/react-dom": "^18.3.5",
"react": "^18.3.1",
"typescript": "^5.5.3"
"typescript": "^5.8.2"
},
"peerDependencies": {
"@rspress/runtime": "workspace:^2.0.0-alpha.2"
"@rspress/runtime": "workspace:^2.0.0-alpha.3"
},
"engines": {
"node": ">=14.17.6"
6 changes: 3 additions & 3 deletions packages/plugin-container-syntax/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@rspress/plugin-container-syntax",
"version": "2.0.0-alpha.2",
"version": "2.0.0-alpha.3",
"description": "A remark plugin to support container syntax",
"bugs": "https://github.com/web-infra-dev/rspress/issues",
"repository": {
@@ -32,8 +32,8 @@
"@rspress/shared": "workspace:*"
},
"devDependencies": {
"@microsoft/api-extractor": "^7.51.1",
"@rslib/core": "0.5.3",
"@microsoft/api-extractor": "^7.52.1",
"@rslib/core": "0.5.4",
"@types/mdast": "^3.0.15",
"mdast-util-mdx-expression": "^1.3.2",
"mdast-util-mdx-jsx": "^2.1.4",
8 changes: 4 additions & 4 deletions packages/plugin-last-updated/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@rspress/plugin-last-updated",
"version": "2.0.0-alpha.2",
"version": "2.0.0-alpha.3",
"description": "A plugin for rspress to record the last updated time of the doc.",
"bugs": "https://github.com/web-infra-dev/rspress/issues",
"repository": {
@@ -32,15 +32,15 @@
"@rspress/shared": "workspace:*"
},
"devDependencies": {
"@microsoft/api-extractor": "^7.51.1",
"@rslib/core": "0.5.3",
"@microsoft/api-extractor": "^7.52.1",
"@rslib/core": "0.5.4",
"@rspress/config": "workspace:*",
"@types/node": "^18.11.17",
"@types/react": "^18.3.18",
"@types/react-dom": "^18.3.5",
"execa": "8.0.1",
"react": "^18.3.1",
"typescript": "^5.5.3"
"typescript": "^5.8.2"
},
"engines": {
"node": ">=14.17.6"
10 changes: 5 additions & 5 deletions packages/plugin-medium-zoom/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@rspress/plugin-medium-zoom",
"version": "2.0.0-alpha.2",
"version": "2.0.0-alpha.3",
"description": "A plugin for rspress to zoom images in docs.",
"bugs": "https://github.com/web-infra-dev/rspress/issues",
"repository": {
@@ -32,18 +32,18 @@
"medium-zoom": "1.1.0"
},
"devDependencies": {
"@microsoft/api-extractor": "^7.51.1",
"@rslib/core": "0.5.3",
"@microsoft/api-extractor": "^7.52.1",
"@rslib/core": "0.5.4",
"@rspress/config": "workspace:*",
"@rspress/shared": "workspace:*",
"@types/node": "^18.11.17",
"@types/react": "^18.3.18",
"@types/react-dom": "^18.3.5",
"react": "^18.3.1",
"typescript": "^5.5.3"
"typescript": "^5.8.2"
},
"peerDependencies": {
"@rspress/runtime": "workspace:^2.0.0-alpha.2"
"@rspress/runtime": "workspace:^2.0.0-alpha.3"
},
"engines": {
"node": ">=14.17.6"
10 changes: 5 additions & 5 deletions packages/plugin-playground/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@rspress/plugin-playground",
"version": "2.0.0-alpha.2",
"version": "2.0.0-alpha.3",
"description": "A plugin for rspress to preview the code block in markdown/mdx file.",
"bugs": "https://github.com/web-infra-dev/rspress/issues",
"repository": {
@@ -42,9 +42,9 @@
"rspack-plugin-virtual-module": "0.1.13"
},
"devDependencies": {
"@babel/types": "^7.26.9",
"@babel/types": "^7.26.10",
"@rsbuild/plugin-react": "~1.1.1",
"@rslib/core": "0.5.3",
"@rslib/core": "0.5.4",
"@types/babel__core": "^7.20.5",
"@types/babel__standalone": "^7.1.9",
"@types/babel__traverse": "^7.20.6",
@@ -56,12 +56,12 @@
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-router-dom": "^6.29.0",
"typescript": "^5.5.3",
"typescript": "^5.8.2",
"unified": "^10.1.2",
"unist-util-visit": "^4.1.2"
},
"peerDependencies": {
"@rspress/core": "workspace:^2.0.0-alpha.2",
"@rspress/core": "workspace:^2.0.0-alpha.3",
"react": ">=17.0.0",
"react-router-dom": "^6.8.1"
},
12 changes: 6 additions & 6 deletions packages/plugin-preview/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@rspress/plugin-preview",
"version": "2.0.0-alpha.2",
"version": "2.0.0-alpha.3",
"description": "A plugin for rspress to preview the code block in markdown/mdx file.",
"bugs": "https://github.com/web-infra-dev/rspress/issues",
"repository": {
@@ -22,7 +22,7 @@
"reset": "rimraf ./**/node_modules"
},
"dependencies": {
"@rsbuild/core": "1.2.16",
"@rsbuild/core": "1.2.19",
"@rsbuild/plugin-babel": "~1.0.4",
"@rsbuild/plugin-less": "~1.1.1",
"@rsbuild/plugin-react": "~1.1.1",
@@ -31,10 +31,10 @@
"@rspress/shared": "workspace:*",
"@rspress/theme-default": "workspace:*",
"lodash": "4.17.21",
"qrcode.react": "^3.2.0"
"qrcode.react": "^4.2.0"
},
"devDependencies": {
"@rslib/core": "0.5.3",
"@rslib/core": "0.5.4",
"@types/lodash": "^4.17.16",
"@types/mdast": "^3.0.15",
"@types/node": "^18.11.17",
@@ -45,12 +45,12 @@
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-router-dom": "^6.29.0",
"typescript": "^5.5.3",
"typescript": "^5.8.2",
"unified": "^10.1.2",
"unist-util-visit": "^4.1.2"
},
"peerDependencies": {
"@rspress/core": "workspace:^2.0.0-alpha.2",
"@rspress/core": "workspace:^2.0.0-alpha.3",
"react": ">=17.0.0",
"react-router-dom": "^6.8.1"
},
6 changes: 1 addition & 5 deletions packages/plugin-preview/static/global-styles/iframe.css
Original file line number Diff line number Diff line change
@@ -23,13 +23,9 @@
margin-left: var(--rp-preview-padding);
}

.rspress-doc-container {
padding-right: var(--rp-preview-padding);
padding-left: var(--rp-preview-padding);
}

.rspress-doc {
width: 100%;
padding-left: var(--rp-preview-padding);
padding-right: var(--rp-preview-padding);
}
}
8 changes: 4 additions & 4 deletions packages/plugin-rss/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@rspress/plugin-rss",
"version": "2.0.0-alpha.2",
"version": "2.0.0-alpha.3",
"description": "A plugin for rss generation for rspress",
"bugs": "https://github.com/web-infra-dev/rspress/issues",
"repository": {
@@ -34,16 +34,16 @@
"feed": "^4.2.2"
},
"devDependencies": {
"@rslib/core": "0.5.3",
"@rslib/core": "0.5.4",
"@rspress/runtime": "workspace:*",
"@types/node": "^18.11.17",
"@types/react": "^18.3.18",
"react": "^18.3.1",
"typescript": "^5.5.3"
"typescript": "^5.8.2"
},
"peerDependencies": {
"react": ">=17.0.0",
"rspress": "workspace:^2.0.0-alpha.2"
"rspress": "workspace:^2.0.0-alpha.3"
},
"engines": {
"node": ">=14.17.6"
8 changes: 4 additions & 4 deletions packages/plugin-shiki/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@rspress/plugin-shiki",
"version": "2.0.0-alpha.2",
"version": "2.0.0-alpha.3",
"description": "A plugin for rspress to record the last updated time of the doc.",
"bugs": "https://github.com/web-infra-dev/rspress/issues",
"repository": {
@@ -35,15 +35,15 @@
"unist-util-visit": "^4.1.2"
},
"devDependencies": {
"@microsoft/api-extractor": "^7.51.1",
"@rslib/core": "0.5.3",
"@microsoft/api-extractor": "^7.52.1",
"@rslib/core": "0.5.4",
"@rspress/config": "workspace:*",
"@types/hast": "^2.3.10",
"@types/node": "^18.11.17",
"@types/react": "^18.3.18",
"@types/react-dom": "^18.3.5",
"react": "^18.3.1",
"typescript": "^5.5.3",
"typescript": "^5.8.2",
"unified": "^10.1.2"
},
"engines": {
10 changes: 5 additions & 5 deletions packages/plugin-typedoc/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@rspress/plugin-typedoc",
"version": "2.0.0-alpha.2",
"version": "2.0.0-alpha.3",
"description": "A plugin for rspress to integrate typedoc",
"bugs": "https://github.com/web-infra-dev/rspress/issues",
"repository": {
@@ -32,17 +32,17 @@
"typedoc-plugin-markdown": "3.17.1"
},
"devDependencies": {
"@microsoft/api-extractor": "^7.51.1",
"@rslib/core": "0.5.3",
"@microsoft/api-extractor": "^7.52.1",
"@rslib/core": "0.5.4",
"@rspress/config": "workspace:*",
"@types/node": "^18.11.17",
"@types/react": "^18.3.18",
"@types/react-dom": "^18.3.5",
"react": "^18.3.1",
"typescript": "^5.5.3"
"typescript": "^5.8.2"
},
"peerDependencies": {
"rspress": "workspace:^2.0.0-alpha.2"
"rspress": "workspace:^2.0.0-alpha.3"
},
"engines": {
"node": ">=14.17.6"
8 changes: 4 additions & 4 deletions packages/runtime/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@rspress/runtime",
"version": "2.0.0-alpha.2",
"version": "2.0.0-alpha.3",
"description": "The Runtime of Rspress Documentation Framework",
"bugs": "https://github.com/web-infra-dev/rspress/issues",
"repository": {
@@ -44,17 +44,17 @@
"@rspress/shared": "workspace:*",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-helmet-async": "^1.3.0",
"react-helmet-async": "^2.0.5",
"react-router-dom": "^6.29.0"
},
"devDependencies": {
"@rsbuild/plugin-react": "~1.1.1",
"@rslib/core": "0.5.3",
"@rslib/core": "0.5.4",
"@rspress/config": "workspace:*",
"@types/jest": "~29.5.14",
"@types/react": "^18.3.18",
"@types/react-dom": "^18.3.5",
"typescript": "^5.5.3"
"typescript": "^5.8.2"
},
"engines": {
"node": ">=14.17.6"
8 changes: 4 additions & 4 deletions packages/shared/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@rspress/shared",
"version": "2.0.0-alpha.2",
"version": "2.0.0-alpha.3",
"repository": {
"type": "git",
"url": "https://github.com/web-infra-dev/rspress",
@@ -41,13 +41,13 @@
"reset": "rimraf ./**/node_modules"
},
"dependencies": {
"@rsbuild/core": "1.2.16",
"@rsbuild/core": "1.2.19",
"gray-matter": "4.0.3",
"lodash-es": "^4.17.21",
"unified": "^10.1.2"
},
"devDependencies": {
"@rslib/core": "0.5.3",
"@rslib/core": "0.5.4",
"@types/fs-extra": "11.0.4",
"@types/jest": "~29.5.14",
"@types/lodash-es": "^4.17.12",
@@ -56,7 +56,7 @@
"mdast-util-mdx-jsx": "^2.1.4",
"medium-zoom": "1.1.0",
"rimraf": "^6.0.1",
"typescript": "^5.5.3"
"typescript": "^5.8.2"
},
"publishConfig": {
"access": "public",
10 changes: 5 additions & 5 deletions packages/theme-default/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@rspress/theme-default",
"version": "2.0.0-alpha.2",
"version": "2.0.0-alpha.3",
"description": "The Default Theme of Rspress Documentation Framework",
"bugs": "https://github.com/web-infra-dev/rspress/issues",
"repository": {
@@ -55,16 +55,16 @@
"nprogress": "^0.2.0",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-helmet-async": "^1.3.0",
"react-helmet-async": "^2.0.5",
"react-syntax-highlighter": "^15.6.1"
},
"devDependencies": {
"@microsoft/api-extractor": "^7.51.1",
"@microsoft/api-extractor": "^7.52.1",
"@modern-js/tsconfig": "2.64.0",
"@rsbuild/plugin-react": "~1.1.1",
"@rsbuild/plugin-sass": "~1.2.2",
"@rsbuild/plugin-svgr": "^1.0.7",
"@rslib/core": "0.5.3",
"@rslib/core": "0.5.4",
"@types/body-scroll-lock": "^3.1.2",
"@types/hast": "^2.3.10",
"@types/jest": "~29.5.14",
@@ -76,7 +76,7 @@
"@types/react-syntax-highlighter": "^15.5.13",
"gray-matter": "4.0.3",
"tailwindcss": "^3.4.17",
"typescript": "^5.5.3"
"typescript": "^5.8.2"
},
"engines": {
"node": ">=14.17.6"
Original file line number Diff line number Diff line change
@@ -12,7 +12,6 @@ interface Props {
langs?: string[];
base: string;
rightIcon?: React.ReactNode;
compact?: boolean;
onClick?: () => void;
}

@@ -30,7 +29,7 @@ export function NavMenuSingleItem(
key={item.text}
className={`rspress-nav-menu-item ${styles.singleItem} ${
isActive ? styles.activeItem : ''
} text-sm font-medium ${item.compact ? 'mx-0.5' : 'mx-1.5'} px-3 py-2 flex items-center`}
} text-sm font-medium mx-0.5 px-3 py-2 flex items-center`}
>
<Tag tag={item.tag} />
{item.text}
15 changes: 14 additions & 1 deletion packages/theme-default/src/components/Nav/index.module.scss
Original file line number Diff line number Diff line change
@@ -24,6 +24,20 @@
// box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.1);
}

.relative {
position: relative;
}

.sticky {
position: sticky;

// https://github.com/web-infra-dev/rspress/issues/1540
+ section :global(.rspress-sidebar-menu-container) {
margin-top: calc(var(--rp-nav-height) * -1);
padding-top: var(--rp-nav-height);
}
}

.leftNav {
display: none;
}
@@ -38,7 +52,6 @@

.activeItem,
.singleItem:hover {
background-color: var(--rp-c-bg-mute);
cursor: pointer;
color: var(--rp-c-link);
border-radius: var(--rp-radius);
18 changes: 7 additions & 11 deletions packages/theme-default/src/components/Nav/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useLocation, usePageData } from '@rspress/runtime';
import type { NavItem } from '@rspress/shared';
import { Search } from '@theme';
import { useEffect, useState } from 'react';
import { useCallback, useEffect, useState } from 'react';
import { useHiddenNav } from '../../logic/useHiddenNav';
import { useNavData } from '../../logic/useNav';
import { isMobileDevice } from '../../logic/utils';
@@ -41,16 +41,16 @@ export function Nav(props: NavProps) {
const socialLinks = siteData.themeConfig.socialLinks || [];
const hasSocialLinks = socialLinks.length > 0;
const langs = localeLanguages.map(item => item.lang || '') || [];
const updateIsMobile = () => {
const updateIsMobile = useCallback(() => {
setIsMobile(isMobileDevice());
};
}, []);
useEffect(() => {
window.addEventListener('resize', updateIsMobile);
setIsMobile(isMobileDevice());
return () => {
window.removeEventListener('resize', updateIsMobile);
};
}, []);
}, [updateIsMobile]);

const NavMenu = ({ menuItems }: { menuItems: NavItem[] }) => {
return (
@@ -72,7 +72,6 @@ export function Nav(props: NavProps) {
langs={langs}
base={base}
key={item.link}
compact={menuItems.length > 5}
{...item}
/>
);
@@ -129,13 +128,10 @@ export function Nav(props: NavProps) {

const computeNavPosition = () => {
// On doc page we have the menu bar that is already sticky
if (!isMobile) {
return 'sticky';
if (!isMobile || !hiddenNav || page.pageType !== 'doc') {
return styles.sticky;
}
if (siteData.themeConfig.hideNavbar === 'never' && page.pageType !== 'doc')
return 'sticky';

return 'relative';
return styles.relative;
};

return (
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@ export interface SearchButtonProps {

export function SearchButton({ setFocused }: SearchButtonProps) {
const [metaKey, setMetaKey] = useState<null | string>(null);
const { searchPlaceholderText = 'Search Docs' } = useLocaleSiteData();
const { searchPlaceholderText = 'Search' } = useLocaleSiteData();
useEffect(() => {
setMetaKey(
/(Mac|iPhone|iPod|iPad)/i.test(navigator.platform) ? '⌘' : 'Ctrl',
Original file line number Diff line number Diff line change
@@ -116,7 +116,7 @@ export function SearchPanel({ focused, setFocused }: SearchPanelProps) {
siteData,
page: { lang, version },
} = usePageData();
const { searchPlaceholderText = 'Search Docs' } = useLocaleSiteData();
const { searchPlaceholderText = 'Search docs' } = useLocaleSiteData();
const { search, title: siteTitle } = siteData;
const versionedSearch =
search && search.mode !== 'remote' && search.versioned;
7 changes: 5 additions & 2 deletions packages/theme-default/src/components/SidebarMenu/index.scss
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
// Only appear on <1280px screen width
.rspress-sidebar-menu {
.rspress-sidebar-menu-container {
position: sticky;
top: 0;
left: 0;
z-index: var(--rp-z-index-local-nav);
}

// Only appear on <1280px screen width
.rspress-sidebar-menu {
display: flex;
justify-content: space-between;
align-items: center;
103 changes: 55 additions & 48 deletions packages/theme-default/src/components/SidebarMenu/index.tsx
Original file line number Diff line number Diff line change
@@ -62,57 +62,64 @@ export function SidebarMenu({
};

return (
<div className="rspress-sidebar-menu">
{uiSwitch?.showSidebar && (
<>
<button onClick={openSidebar} className="flex-center mr-auto">
<div className="text-md mr-2">
<SvgWrapper icon={MenuIcon} />
</div>
<span className="text-sm">Menu</span>
</button>
{isSidebarOpen && (
<div
onClick={closeSidebar}
className="rspress-sidebar-back-drop"
style={{
background: 'rgba(0, 0, 0, 0.6)',
}}
/>
)}
</>
)}
{uiSwitch?.showAside && (
<>
<button
onClick={() => setIsTocOpen(tocOpened => !tocOpened)}
className="flex-center ml-auto"
ref={outlineButtonRef}
>
<span className="text-sm">{outlineTitle}</span>
<div className="rspress-sidebar-menu-container">
<div className="rspress-sidebar-menu">
{uiSwitch?.showSidebar && (
<>
<button
type="button"
onClick={openSidebar}
className="flex-center mr-auto"
>
<div className="text-md mr-2">
<SvgWrapper icon={MenuIcon} />
</div>
<span className="text-sm">Menu</span>
</button>
{isSidebarOpen && (
<div
onClick={closeSidebar}
className="rspress-sidebar-back-drop"
style={{
background: 'rgba(0, 0, 0, 0.6)',
}}
/>
)}
</>
)}
{uiSwitch?.showAside && (
<>
<button
type="button"
onClick={() => setIsTocOpen(tocOpened => !tocOpened)}
className="flex-center ml-auto"
ref={outlineButtonRef}
>
<span className="text-sm">{outlineTitle}</span>
<div
className="text-md mr-2"
style={{
transform: isTocOpen ? 'rotate(90deg)' : 'rotate(0deg)',
transition: 'transform 0.2s ease-out',
marginTop: '2px',
}}
>
<SvgWrapper icon={ArrowRight} />
</div>
</button>

<div
className="text-md mr-2"
style={{
transform: isTocOpen ? 'rotate(90deg)' : 'rotate(0deg)',
transition: 'transform 0.2s ease-out',
marginTop: '2px',
}}
className={`rspress-local-toc-container ${isTocOpen ? 'rspress-local-toc-container-show' : ''}`}
>
<SvgWrapper icon={ArrowRight} />
<Toc
onItemClick={() => {
setIsTocOpen(false);
}}
/>
</div>
</button>

<div
className={`rspress-local-toc-container ${isTocOpen ? 'rspress-local-toc-container-show' : ''}`}
>
<Toc
onItemClick={() => {
setIsTocOpen(false);
}}
/>
</div>
</>
)}
</>
)}
</div>
</div>
);
}
Original file line number Diff line number Diff line change
@@ -45,6 +45,24 @@
}
}

// Display external link icon
.link[target='_blank'] {
&::after {
content: '';
font-weight: 700;
display: inline-block;
font-size: 0.7em;
transform: translate(0, -0.3em);
transition: transform 0.2s ease;
margin-left: 0.2em;
margin-right: 0.1em;
}

&:hover::after {
transform: translate(0.1em, -0.5em);
}
}

:global(.header-anchor) {
color: var(--rp-c-brand);
}
20 changes: 15 additions & 5 deletions packages/theme-default/src/layout/DocLayout/index.module.scss
Original file line number Diff line number Diff line change
@@ -59,11 +59,22 @@
}

.content {
padding: var(--rp-content-padding-y) var(--rp-content-padding-x);
:global(.rspress-doc),
:global(.rspress-doc-footer) {
padding: var(--rp-content-padding-y) var(--rp-content-padding-x);
}

:global(.rspress-doc) {
padding-bottom: 0;
}

:global(.rspress-doc-footer) {
padding-top: 0;
}
}

@media (max-width: 960px) {
:root {
html:root {
--rp-content-padding-y: 36px;
}

@@ -83,8 +94,8 @@
}

@media (min-width: 1280px) {
:root {
--rp-content-padding-x: 0;
html:root {
--rp-content-padding-x: 64px;
}

.aside-container {
@@ -94,7 +105,6 @@
.content {
:global(.rspress-doc),
:global(.rspress-doc-footer) {
padding: 0 64px;
max-width: min(100%, calc(864px + 64px * 2));
margin: auto;
}
25 changes: 10 additions & 15 deletions packages/theme-default/src/layout/DocLayout/index.tsx
Original file line number Diff line number Diff line change
@@ -82,7 +82,7 @@ export function DocLayout(props: DocLayoutProps) {
</H1>
)
);
}, [headingTitle, title]);
}, [headingTitle, title, siteData.themeConfig.fallbackHeadingTitle]);

const [isSidebarOpen, setIsSidebarOpen] = useState(false);

@@ -109,7 +109,7 @@ export function DocLayout(props: DocLayoutProps) {
uiSwitch={uiSwitch}
/>
<div className={`${styles.content} rspress-doc-container flex`}>
<div className="flex-1 overflow-x-auto">
<div className={`flex-1 ${isOverviewPage ? '' : 'overflow-x-auto'}`}>
{isOverviewPage ? (
<>
{beforeDocContent}
@@ -140,20 +140,15 @@ export function DocLayout(props: DocLayoutProps) {
{uiSwitch?.showAside && (
<div
className={styles.asideContainer}
style={{
...(uiSwitch?.showNavbar
? {}
: {
marginTop: 0,
paddingTop: '32px',
}),
}}
style={
uiSwitch?.showNavbar
? undefined
: { marginTop: 0, paddingTop: '32px' }
}
>
<div>
{beforeOutline}
<Aside headers={headers} outlineTitle={outlineTitle} />
{afterOutline}
</div>
{beforeOutline}
<Aside headers={headers} outlineTitle={outlineTitle} />
{afterOutline}
</div>
)}
</div>
886 changes: 411 additions & 475 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion scripts/config/package.json
Original file line number Diff line number Diff line change
@@ -4,6 +4,6 @@
"private": true,
"devDependencies": {
"@types/node": "^18.11.17",
"typescript": "^5.5.3"
"typescript": "^5.8.2"
}
}