Skip to content

Commit ed69744

Browse files
authored
Merge branch 'main' into fix/848-exclude-excluded-routes-from-sidebar
2 parents d081634 + 221da5e commit ed69744

File tree

117 files changed

+1788
-704
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

117 files changed

+1788
-704
lines changed

.changeset/nasty-carrots-share.md

-5
This file was deleted.

.changeset/sixty-dolls-accept.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@rspress/plugin-preview": patch
3+
---
4+
5+
feat: support code transform in preview plugin

e2e/fixtures/auto-nav-sidebar/doc/_meta.json

+4
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,9 @@
22
{
33
"text": "Guide",
44
"link": "/guide/"
5+
},
6+
{
7+
"text": "Api",
8+
"link": "/api/"
59
}
610
]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
[
2+
{
3+
"type": "file",
4+
"name": "index",
5+
"label": "API Overview"
6+
},
7+
{
8+
"type": "dir",
9+
"name": "config",
10+
"label": "Config"
11+
},
12+
{
13+
"type": "dir",
14+
"name": "client-api",
15+
"label": "Client API"
16+
},
17+
"commands"
18+
]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
[
2+
{
3+
"type": "file",
4+
"name": "index",
5+
"label": "Client API Overview"
6+
},
7+
{
8+
"type": "file",
9+
"name": "api-runtime",
10+
"overviewHeaders": []
11+
},
12+
"api-components"
13+
]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# 内置组件
2+
3+
## 用法
4+
5+
## 示例
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Runtime API
2+
3+
## usePageData
4+
5+
## useLang
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
overview: true
3+
---
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# 命令
2+
3+
## rspress dev
4+
5+
## rspress build
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
overview: true
3+
overviewHeaders: [2]
4+
---
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[
2+
"config-basic",
3+
"config-theme",
4+
"config-frontmatter",
5+
{
6+
"type": "file",
7+
"name": "config-build",
8+
"overviewHeaders": [2, 3]
9+
}
10+
]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# 基础配置
2+
3+
## root
4+
5+
## logoText
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# 构建配置
2+
3+
## builderConfig
4+
5+
### 默认配置
6+
7+
## markdown
8+
9+
### markdown.remarkPlugins
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
overviewHeaders: []
3+
---
4+
5+
# Front Matter 配置
6+
7+
## title
8+
9+
## description
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# 主题配置
2+
3+
## nav
4+
5+
## sidebar
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
overview: true
3+
---
File renamed without changes.
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
# Hello World
1+
# Guide
22

33
```jsx
44
export default function HelloWorld() {
5-
return <div>Hello World</div>;
5+
return <div>Hello</div>;
66
}
77
```
File renamed without changes.
File renamed without changes.

e2e/fixtures/plugin/rspress.config.ts e2e/fixtures/custom-plugin/rspress.config.ts

+16-1
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,24 @@ export default defineConfig({
1111
pluginPreview({
1212
isMobile: true,
1313
iframeOptions: {
14-
framework: 'react'
14+
framework: 'react',
1515
},
1616
iframePosition: 'fixed',
17+
previewLanguages: ['jsx', 'tsx', 'json'],
18+
previewCodeTransform(codeInfo) {
19+
if (codeInfo.language === 'json') {
20+
return `
21+
import React from 'react';
22+
23+
const json = ${codeInfo.code};
24+
25+
export default function() {
26+
return React.createElement(json.type, null, json.children);
27+
}
28+
`;
29+
}
30+
return codeInfo.code;
31+
},
1732
}),
1833
// pluginPlayground(),
1934
],
File renamed without changes.

e2e/fixtures/i18n/doc/en/guide/_meta.json

+5
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,10 @@
1010
{
1111
"type": "section-header",
1212
"label": "growth"
13+
},
14+
{
15+
"type": "custom-link",
16+
"label": "My Link",
17+
"link": "/guide/basic/install"
1318
}
1419
]

e2e/fixtures/i18n/doc/zh/guide/_meta.json

+5
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,10 @@
1010
{
1111
"type": "section-header",
1212
"label": "growth"
13+
},
14+
{
15+
"type": "custom-link",
16+
"label": "My Link",
17+
"link": "/guide/basic/install"
1318
}
1419
]
+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
pageType: home
3+
hero:
4+
name: E2E case title
5+
text: E2E case subTitle
6+
tagline: E2E case tagline
7+
actions:
8+
- text: Action 1
9+
link: /action-1
10+
- text: Action 2
11+
link: /action-2
12+
theme: brand
13+
- text: External
14+
link: https://example.com/
15+
theme: alt
16+
image:
17+
src: /brand.png
18+
alt: E2E case brand image
19+
srcset:
20+
- /brand.png
21+
22+
sizes:
23+
- '((min-width: 50em) and (max-width: 60em)) 50em'
24+
- "(max-width: 30em) 20em"
25+
---
+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"name": "@rspress-fixture/page-type-home",
3+
"version": "1.0.0",
4+
"private": true,
5+
"scripts": {
6+
"dev": "rspress dev",
7+
"build": "rspress build",
8+
"preview": "rspress preview"
9+
},
10+
"dependencies": {
11+
"rspress": "workspace:*"
12+
},
13+
"devDependencies": {
14+
"@types/node": "^14"
15+
}
16+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import * as path from 'path';
2+
import { defineConfig } from 'rspress/config';
3+
4+
export default defineConfig({
5+
root: path.join(__dirname, 'doc'),
6+
});
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export default function HelloWorld() {
2+
return <div>Hello World External</div>;
3+
}
+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Guide
2+
3+
```jsx
4+
export default function HelloWorld() {
5+
return <div>Hello World Internal</div>;
6+
}
7+
```
8+
9+
<code src="./component.jsx" />
10+
11+
```json
12+
{
13+
"type": "div",
14+
"children": "Render from JSON"
15+
}
16+
```
+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"name": "@rspress-fixture/plugin-preview",
3+
"version": "1.0.0",
4+
"private": true,
5+
"scripts": {
6+
"dev": "rspress dev",
7+
"build": "rspress build",
8+
"preview": "rspress preview"
9+
},
10+
"dependencies": {
11+
"@rspress/plugin-playground": "workspace:*",
12+
"@rspress/plugin-preview": "workspace:*",
13+
"@rspress/shared": "workspace:*",
14+
"react": "^18",
15+
"react-dom": "^18",
16+
"react-transition-group": "4.4.5",
17+
"rspress": "workspace:*",
18+
"solid-js": "^1.8.12"
19+
},
20+
"devDependencies": {
21+
"@types/node": "^14"
22+
}
23+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import path from 'path';
2+
import { defineConfig } from 'rspress/config';
3+
import { pluginPreview } from '@rspress/plugin-preview';
4+
5+
export default defineConfig({
6+
root: path.join(__dirname, 'doc'),
7+
plugins: [
8+
pluginPreview({
9+
isMobile: true,
10+
iframeOptions: {
11+
framework: 'react',
12+
},
13+
iframePosition: 'fixed',
14+
previewLanguages: ['jsx', 'tsx', 'json'],
15+
previewCodeTransform(codeInfo) {
16+
if (codeInfo.language === 'json') {
17+
return `
18+
import React from 'react';
19+
20+
const json = ${codeInfo.code};
21+
22+
export default function() {
23+
return React.createElement(json.type, null, json.children);
24+
}
25+
`;
26+
}
27+
return codeInfo.code;
28+
},
29+
}),
30+
],
31+
});
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"compilerOptions": {
3+
"esModuleInterop": true,
4+
"jsx": "react-jsx"
5+
}
6+
}

e2e/fixtures/plugin-rss/doc/blog/bar.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: Bar but Frontmatter
3-
date: 2024-01-02 08:00:00
3+
date: 2024-01-01 08:00:00
44
category: development
55
slug: bar
66
author:

e2e/fixtures/plugin-rss/doc/blog/foo.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
date: 2024-01-01 08:00:00
2+
date: 2024-01-02 08:00:00
33
id: foo
44
summary: |
55
This is summary

e2e/fixtures/plugin/doc/components/component.jsx

-3
This file was deleted.

e2e/fixtures/plugin/doc/components/guide.mdx

-15
This file was deleted.

0 commit comments

Comments
 (0)