File tree Expand file tree Collapse file tree 1 file changed +14
-8
lines changed Expand file tree Collapse file tree 1 file changed +14
-8
lines changed Original file line number Diff line number Diff line change @@ -98,16 +98,20 @@ const findLinksAndImage = (
98
98
return ;
99
99
case "link" :
100
100
switch ( node . pathType ) {
101
- case "relative" :
102
- if ( linksLc . get ( toTitleLc ( node . href ) ) ) return ;
103
- linksLc . set ( toTitleLc ( node . href ) , true ) ;
104
- links . push ( node . href ) ;
101
+ case "relative" : {
102
+ const link = cutId ( node . href ) ;
103
+ if ( linksLc . get ( toTitleLc ( link ) ) ) return ;
104
+ linksLc . set ( toTitleLc ( link ) , true ) ;
105
+ links . push ( link ) ;
105
106
return ;
106
- case "root" :
107
- if ( projectLinksLc . has ( toTitleLc ( node . href ) ) ) return ;
108
- projectLinksLc . add ( toTitleLc ( node . href ) ) ;
109
- projectLinks . push ( node . href ) ;
107
+ }
108
+ case "root" : {
109
+ const link = cutId ( node . href ) ;
110
+ if ( projectLinksLc . has ( toTitleLc ( link ) ) ) return ;
111
+ projectLinksLc . add ( toTitleLc ( link ) ) ;
112
+ projectLinks . push ( link ) ;
110
113
return ;
114
+ }
111
115
case "absolute" : {
112
116
const props = parseYoutube ( node . href ) ;
113
117
if ( ! props || props . pathType === "list" ) return ;
@@ -167,3 +171,5 @@ function* blocksToNodes(blocks: Iterable<Block>) {
167
171
}
168
172
}
169
173
}
174
+
175
+ const cutId = ( link : string ) : string => link . replace ( / # [ a - f \d ] { 24 , 32 } $ / , "" ) ;
You can’t perform that action at this time.
0 commit comments