Commit 4339fdf 1 parent 6c864a7 commit 4339fdf Copy full SHA for 4339fdf
File tree 1 file changed +6
-6
lines changed
1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change 1
1
import fs from "fs" ;
2
2
3
3
export function formatFileContent ( file : string ) {
4
- let content = fs . readFileSync ( file , "utf8" ) ;
5
-
6
- addGitHubCodeBlocks ( content ) ;
7
-
8
- fs . writeFileSync ( file , content ) ;
4
+ addGitHubCodeBlocks ( file ) ;
9
5
}
10
6
11
- function addGitHubCodeBlocks ( content : string ) {
7
+ function addGitHubCodeBlocks ( file : string ) {
8
+ let content = fs . readFileSync ( file , "utf8" ) ;
9
+
12
10
const ghBlobUrlRegex =
13
11
/ h t t p s : \/ \/ g i t h u b \. c o m \/ [ A - Z a - z ] + \/ ( [ A - Z a - z ] + ( - [ A - Z a - z ] + ) + ) \/ b l o b \/ [ A - Z a - z 0 - 9 ] + \/ ( [ A - Z a - z ] + ( \/ [ A - Z a - z ] + ) + ) \. [ A - Z a - z ] + # L [ 0 - 9 ] + - L [ 0 - 9 ] + / g;
14
12
@@ -24,4 +22,6 @@ function addGitHubCodeBlocks(content: string) {
24
22
25
23
content = content . replace ( url , codeBlockForUrl ) ;
26
24
}
25
+
26
+ fs . writeFileSync ( file , content ) ;
27
27
}
You can’t perform that action at this time.
0 commit comments