@@ -10,22 +10,23 @@ function removeLlmButtons() {
1010 // Remove text nodes that contain LLM button text
1111 visit ( tree , 'text' , ( node , index , parent ) => {
1212 if ( node . value && (
13- node . value . includes ( 'View as Markdown' ) ||
14- node . value . includes ( 'Copy for LLM' ) ||
15- node . value . includes ( 'View as MarkdownCopy for LLM' ) ||
16- node . value . trim ( ) === 'View as Markdown' ||
17- node . value . trim ( ) === 'Copy for LLM'
13+ node . value . includes ( 'View as Markdown' )
14+ || node . value . includes ( 'Copy for LLM' )
15+ || node . value . includes ( 'View as MarkdownCopy for LLM' )
16+ || node . value . trim ( ) === 'View as Markdown'
17+ || node . value . trim ( ) === 'Copy for LLM'
1818 ) ) {
1919 // Remove the text node
2020 parent . children . splice ( index , 1 ) ;
2121 return index ; // Adjust index after removal
2222 }
23+ return undefined ; // Explicit return for consistency
2324 } ) ;
2425
2526 // Clean up empty paragraphs that resulted from text removal
2627 visit ( tree , 'paragraph' , ( node , index , parent ) => {
2728 // Check if paragraph is empty or only contains whitespace
28- const hasContent = node . children && node . children . some ( child => {
29+ const hasContent = node . children && node . children . some ( ( child ) => {
2930 if ( child . type === 'text' ) {
3031 return child . value && child . value . trim ( ) . length > 0 ;
3132 }
@@ -37,6 +38,7 @@ function removeLlmButtons() {
3738 parent . children . splice ( index , 1 ) ;
3839 return index ;
3940 }
41+ return undefined ; // Explicit return for consistency
4042 } ) ;
4143 } ;
4244}
0 commit comments