File tree Expand file tree Collapse file tree 2 files changed +9
-3
lines changed
generators/llms-txt/utils Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ import { transformNodeToString } from '../../../utils/unist.mjs';
11
11
*/
12
12
export const getEntryDescription = entry => {
13
13
if ( entry . llm_description ) {
14
- return entry . llm_description ;
14
+ return entry . llm_description . trim ( ) ;
15
15
}
16
16
17
17
const descriptionNode = entry . content . children . find (
Original file line number Diff line number Diff line change @@ -16,8 +16,14 @@ export const transformNodeToString = node => {
16
16
return `**${ transformNodesToString ( node . children ) } **` ;
17
17
case 'emphasis' :
18
18
return `_${ transformNodesToString ( node . children ) } _` ;
19
- default :
20
- return node . children ? transformNodesToString ( node . children ) : node . value ;
19
+ default : {
20
+ if ( node . children ) {
21
+ return transformNodesToString ( node . children ) ;
22
+ }
23
+
24
+ // Replace line breaks (\n) with spaces to keep text in a single line
25
+ return node . value ?. replace ( / \n / g, ' ' ) || '' ;
26
+ }
21
27
}
22
28
} ;
23
29
You can’t perform that action at this time.
0 commit comments