Skip to content

Commit 06f4244

Browse files
authored
fix(site): fixed the issue of rendering failure of design guide docs (#3923)
1 parent 23a89dc commit 06f4244

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

packages/tdesign-miniprogram-chat/site/plugins/plugin-tdoc/md-to-vue.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ function customRender({ source, file, md }: any) {
3939
};
4040

4141
// md filename
42-
const reg = file.match(/src\/(\S*)(?=\/\S*.md)/);
42+
const reg = file.match(/components\/(\S*)(?=\/\S*.md)/);
4343
const componentName = reg && reg[1];
4444

4545
// split md
@@ -69,7 +69,7 @@ function customRender({ source, file, md }: any) {
6969

7070
// 设计指南内容 不展示 design Tab 则不解析
7171
if (pageData.isComponent && pageData.tdDocTabs.some((item) => item.tab === 'design')) {
72-
const designDocPath = path.resolve(__dirname, `../../common/docs/mobile/design/${componentName}.md`);
72+
const designDocPath = path.resolve(__dirname, `../../../../common/docs/mobile/design/${componentName}.md`);
7373

7474
if (fs.existsSync(designDocPath)) {
7575
const designMd = fs.readFileSync(designDocPath, 'utf-8');

packages/tdesign-miniprogram-chat/site/plugins/plugin-tdoc/transforms.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ let demoCodesImports: Record<string, string> = {};
77
export default {
88
before({ source, file, md }: any) {
99
const resourceDir = path.dirname(file);
10-
const reg = file.match(/packages\/components\/(\S*)(?=\/\S*.md)/);
10+
const reg = file.match(/packages\/pro-components\/(\S*)(?=\/\S*.md)/);
1111
const name = reg && reg[1];
1212
demoCodesImports = {};
1313

packages/tdesign-miniprogram/site/plugins/plugin-tdoc/md-to-vue.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ function customRender({ source, file, md }: any) {
3939
};
4040

4141
// md filename
42-
const reg = file.match(/src\/(\S*)(?=\/\S*.md)/);
42+
const reg = file.match(/components\/(\S*)(?=\/\S*.md)/);
4343
const componentName = reg && reg[1];
4444

4545
// split md
@@ -69,7 +69,7 @@ function customRender({ source, file, md }: any) {
6969

7070
// 设计指南内容 不展示 design Tab 则不解析
7171
if (pageData.isComponent && pageData.tdDocTabs.some((item) => item.tab === 'design')) {
72-
const designDocPath = path.resolve(__dirname, `../../common/docs/mobile/design/${componentName}.md`);
72+
const designDocPath = path.resolve(__dirname, `../../../../common/docs/mobile/design/${componentName}.md`);
7373

7474
if (fs.existsSync(designDocPath)) {
7575
const designMd = fs.readFileSync(designDocPath, 'utf-8');

0 commit comments

Comments
 (0)