@@ -73,10 +73,11 @@ export async function getOutlineNodes(
7373 page : Page ,
7474 tags : string [ ] ,
7575 outlineContainerSelector = '' ,
76+ outlineExcludeSelector = '' ,
7677) {
7778 const preSelector = formatOutlineContainerSelector ( outlineContainerSelector )
7879 return await page . evaluate (
79- ( [ tags , outlineSelector ] ) => {
80+ ( [ tags , outlineSelector , outlineExcludeSelector ] ) => {
8081 const tagsToProcess = Array . from (
8182 document . querySelectorAll < HTMLElement > ( outlineSelector ) ,
8283 ) . reverse ( )
@@ -85,6 +86,7 @@ export async function getOutlineNodes(
8586 depth : - 1 ,
8687 parent : undefined ,
8788 }
89+
8890 let currentOutlineNode = root
8991
9092 const linkHolder = document . createElement ( 'div' )
@@ -94,6 +96,11 @@ export async function getOutlineNodes(
9496
9597 while ( tagsToProcess . length > 0 ) {
9698 const tag = tagsToProcess . pop ( ) !
99+
100+ if ( outlineExcludeSelector && tag . matches ( outlineExcludeSelector ) ) {
101+ continue
102+ }
103+
97104 const orderDepth = tags . indexOf ( tag . tagName . toLowerCase ( ) )
98105 const dest = encodeURIComponent ( tag . id )
99106
@@ -143,6 +150,7 @@ export async function getOutlineNodes(
143150 [
144151 tags ,
145152 tags . map ( ( titleItem ) => `${ preSelector } ${ titleItem } ` ) . join ( ',' ) ,
153+ outlineExcludeSelector ,
146154 ] as const ,
147155 )
148156}
0 commit comments