@@ -18,6 +18,15 @@ interface MinimizeOptions {
1818 normalize_whitespace : boolean ;
1919}
2020
21+ const defaults : MinimizeOptions = {
22+ remove_legacy : false ,
23+ remove_note_blocks : false ,
24+ remove_details_blocks : false ,
25+ remove_playground_links : false ,
26+ remove_prettier_ignore : false ,
27+ normalize_whitespace : false
28+ } ;
29+
2130export function generate_llm_content ( options : GenerateLlmContentOptions = { } ) : string {
2231 let content = '' ;
2332
@@ -47,13 +56,13 @@ export function generate_llm_content(options: GenerateLlmContentOptions = {}): s
4756 }
4857 }
4958
50- const docContent = options . minimize
59+ const doc_content = options . minimize
5160 ? minimize_content ( index [ path ] . body , options . minimize )
5261 : index [ path ] . body ;
53- if ( docContent . trim ( ) === '' ) continue ;
62+ if ( doc_content . trim ( ) === '' ) continue ;
5463
5564 content += `\n# ${ index [ path ] . metadata . title } \n\n` ;
56- content += docContent ;
65+ content += doc_content ;
5766 content += '\n' ;
5867 }
5968
@@ -78,7 +87,7 @@ export function get_documentation_start_title(type: string): string {
7887
7988function minimize_content ( content : string , options ?: Partial < MinimizeOptions > ) : string {
8089 // Merge with defaults, but only for properties that are defined
81- const settings : MinimizeOptions = options ? { ...defaultOptions , ...options } : defaultOptions ;
90+ const settings : MinimizeOptions = { ...defaults , ...options } ;
8291
8392 let minimized = content ;
8493
@@ -116,8 +125,7 @@ function minimize_content(content: string, options?: Partial<MinimizeOptions>):
116125}
117126
118127function should_include_file_llm_docs ( filename : string , ignore : string [ ] = [ ] ) : boolean {
119- const shouldIgnore = ignore . some ( ( pattern ) => minimatch ( filename , pattern ) ) ;
120- if ( shouldIgnore ) {
128+ if ( ignore . some ( ( pattern ) => minimatch ( filename , pattern ) ) ) {
121129 if ( dev ) console . log ( `❌ Ignored by pattern: ${ filename } ` ) ;
122130 return false ;
123131 }
@@ -157,15 +165,6 @@ function sort_documentation_paths(): string[] {
157165 } ) ;
158166}
159167
160- const defaultOptions : MinimizeOptions = {
161- remove_legacy : false ,
162- remove_note_blocks : false ,
163- remove_details_blocks : false ,
164- remove_playground_links : false ,
165- remove_prettier_ignore : false ,
166- normalize_whitespace : false
167- } ;
168-
169168function remove_quote_blocks ( content : string , blockType : string ) : string {
170169 return content
171170 . split ( '\n' )
0 commit comments