File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed
packages/cli/doc-core/src/node/runtimeModule Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ ' @modern-js/doc-core ' : patch
3
+ ---
4
+
5
+ fix(doc-core): external link normalize
6
+
7
+ fix(doc-core): 修复外部链接不规范的问题
Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ import {
28
28
MDX_REGEXP ,
29
29
SEARCH_INDEX_NAME ,
30
30
addLeadingSlash ,
31
+ isExternalUrl ,
31
32
} from '@/shared/utils' ;
32
33
33
34
let pages : PageIndexInfo [ ] | undefined ;
@@ -66,7 +67,12 @@ export function normalizeThemeConfig(
66
67
const i18nTextData = getI18nData ( docConfig ) ;
67
68
// In following code, we will normalize the theme config reference to the pages data extracted from mdx files
68
69
const normalizeLangPrefix = ( link ?: string , currentLang ?: string ) => {
69
- if ( ! currentLang || ! link || link . startsWith ( `/${ currentLang } ` ) ) {
70
+ if (
71
+ ! currentLang ||
72
+ ! link ||
73
+ link . startsWith ( `/${ currentLang } ` ) ||
74
+ isExternalUrl ( link )
75
+ ) {
70
76
return link ;
71
77
}
72
78
// if lang exists, we should add the lang prefix to the link
You can’t perform that action at this time.
0 commit comments