File tree 5 files changed +17
-22
lines changed
packages/typedoc-plugin-markdown/src
5 files changed +17
-22
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ ' typedoc-plugin-markdown ' : patch
3
+ ---
4
+
5
+ - Ensure all file paths use forward slashes in windows (#782 ).
Original file line number Diff line number Diff line change @@ -7,8 +7,9 @@ export function getFilePath(filePathWithExtension: string) {
7
7
if ( ! filePathWithExtension ) {
8
8
return '' ;
9
9
}
10
- return path . join (
10
+ const filePath = path . join (
11
11
path . dirname ( filePathWithExtension ) ,
12
12
path . basename ( filePathWithExtension , path . extname ( filePathWithExtension ) ) ,
13
13
) ;
14
+ return filePath . replace ( / \\ / g, '/' ) ;
14
15
}
Original file line number Diff line number Diff line change 1
- import * as path from 'path' ;
2
-
3
1
export function replaceFilename ( originalPath : string , newFileName : string ) {
4
- const normalizedPath = originalPath . replace ( / \\ / g, '/' ) ;
5
- const updatedPath = normalizedPath . replace (
6
- / \/ [ ^ / ] + ( \. [ ^ / . ] + ) $ / ,
7
- `${ path . sep } ${ newFileName } $1` ,
8
- ) ;
9
- return path . sep === '\\' ? updatedPath . replace ( / \/ / g, '\\' ) : updatedPath ;
2
+ return originalPath
3
+ . replace ( / \\ / g, '/' )
4
+ . replace ( / \/ [ ^ / ] + ( \. [ ^ / . ] + ) $ / , `/${ newFileName } $1` ) ;
10
5
}
Original file line number Diff line number Diff line change 1
- import { removeFirstScopedDirectory } from '@plugin/libs/utils/index.js' ;
1
+ import {
2
+ removeFirstScopedDirectory ,
3
+ replaceFilename ,
4
+ } from '@plugin/libs/utils/index.js' ;
2
5
import { MarkdownRenderer } from '@plugin/types/markdown-renderer.js' ;
3
6
import * as path from 'path' ;
4
7
import {
@@ -28,12 +31,6 @@ export class KindStructureRouter extends MarkdownRouter {
28
31
if ( this . isPackages ) {
29
32
const meta = ( this . application . renderer as MarkdownRenderer )
30
33
?. packagesMeta [ reflection . name ] ;
31
- const replaceFilename = ( originalPath : string , newFileName : string ) => {
32
- return originalPath . replace (
33
- / \/ [ ^ / ] + ( \. [ ^ / . ] + ) $ / ,
34
- `/${ newFileName } $1` ,
35
- ) ;
36
- } ;
37
34
if (
38
35
meta &&
39
36
( reflection as DeclarationReflection ) . readme &&
@@ -132,6 +129,7 @@ export class KindStructureRouter extends MarkdownRouter {
132
129
}
133
130
let fullName = path
134
131
. join ( [ dir , fileName ] . filter ( ( part ) => ! ! part ) . join ( '/' ) )
132
+ . replace ( / \\ / g, '/' )
135
133
. replace ( / / g, '-' ) ;
136
134
137
135
if ( this . ignoreScopes ) {
Original file line number Diff line number Diff line change 1
1
import {
2
2
removeFirstScopedDirectory ,
3
+ replaceFilename ,
3
4
toPascalCase ,
4
5
} from '@plugin/libs/utils/index.js' ;
5
6
import { MarkdownRenderer } from '@plugin/types/markdown-renderer.js' ;
@@ -31,12 +32,6 @@ export class ModuleRouter extends MarkdownRouter {
31
32
if ( this . isPackages ) {
32
33
const meta = ( this . application . renderer as MarkdownRenderer )
33
34
?. packagesMeta [ reflection . name ] ;
34
- const replaceFilename = ( originalPath : string , newFileName : string ) => {
35
- return originalPath . replace (
36
- / \/ [ ^ / ] + ( \. [ ^ / . ] + ) $ / ,
37
- `/${ newFileName } $1` ,
38
- ) ;
39
- } ;
40
35
if (
41
36
meta &&
42
37
( reflection as DeclarationReflection ) . readme &&
@@ -132,6 +127,7 @@ export class ModuleRouter extends MarkdownRouter {
132
127
}
133
128
let fullName = path
134
129
. join ( [ dir , fileName ] . filter ( ( part ) => ! ! part ) . join ( '/' ) )
130
+ . replace ( / \\ / g, '/' )
135
131
. replace ( / / g, '-' ) ;
136
132
if ( this . ignoreScopes ) {
137
133
fullName = removeFirstScopedDirectory ( fullName ) ;
You can’t perform that action at this time.
0 commit comments