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 = (
9898 return ;
9999 case "link" :
100100 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 ) ;
105106 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 ) ;
110113 return ;
114+ }
111115 case "absolute" : {
112116 const props = parseYoutube ( node . href ) ;
113117 if ( ! props || props . pathType === "list" ) return ;
@@ -167,3 +171,5 @@ function* blocksToNodes(blocks: Iterable<Block>) {
167171 }
168172 }
169173}
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