@@ -42,20 +42,28 @@ export function* makeChanges(
4242 }
4343
4444 // リンクと画像の差分を入れる
45- const [ links , image ] = findLinksAndImage ( right_ . join ( "\n" ) ) ;
45+ const [ links , projectLinks , image ] = findLinksAndImage ( right_ . join ( "\n" ) ) ;
4646 if (
4747 head . links . length !== links . length ||
4848 ! head . links . every ( ( link ) => links . includes ( link ) )
4949 ) {
5050 yield { links } ;
5151 }
52+ if (
53+ head . projectLinks . length !== projectLinks . length ||
54+ ! head . projectLinks . every ( ( link ) => projectLinks . includes ( link ) )
55+ ) {
56+ yield { projectLinks } ;
57+ }
5258 if ( head . image !== image ) {
5359 yield { image } ;
5460 }
5561}
5662
5763/** テキストに含まれる全てのリンクと最初の画像を探す */
58- const findLinksAndImage = ( text : string ) : [ string [ ] , string | null ] => {
64+ const findLinksAndImage = (
65+ text : string ,
66+ ) : [ string [ ] , string [ ] , string | null ] => {
5967 const rows = parseToRows ( text ) ;
6068 const blocks = packRows ( rows , { hasTitle : true } ) . flatMap ( ( pack ) => {
6169 switch ( pack . type ) {
@@ -77,6 +85,8 @@ const findLinksAndImage = (text: string): [string[], string | null] => {
7785 */
7886 const linksLc = new Map < string , boolean > ( ) ;
7987 const links = [ ] as string [ ] ;
88+ const projectLinksLc = new Set < string > ( ) ;
89+ const projectLinks = [ ] as string [ ] ;
8090 let image : string | null = null ;
8191
8292 const lookup = ( node : Node ) => {
@@ -93,6 +103,11 @@ const findLinksAndImage = (text: string): [string[], string | null] => {
93103 linksLc . set ( toTitleLc ( node . href ) , true ) ;
94104 links . push ( node . href ) ;
95105 return ;
106+ case "root" :
107+ if ( projectLinksLc . has ( toTitleLc ( node . href ) ) ) return ;
108+ projectLinksLc . add ( toTitleLc ( node . href ) ) ;
109+ projectLinks . push ( node . href ) ;
110+ return ;
96111 case "absolute" : {
97112 const props = parseYoutube ( node . href ) ;
98113 if ( ! props || props . pathType === "list" ) return ;
@@ -125,7 +140,7 @@ const findLinksAndImage = (text: string): [string[], string | null] => {
125140 lookup ( node ) ;
126141 }
127142
128- return [ links , image ] ;
143+ return [ links , projectLinks , image ] ;
129144} ;
130145
131146function * blocksToNodes ( blocks : Iterable < Block > ) {
0 commit comments