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';
1111 */
1212export const getEntryDescription = entry => {
1313 if ( entry . llm_description ) {
14- return entry . llm_description ;
14+ return entry . llm_description . trim ( ) ;
1515 }
1616
1717 const descriptionNode = entry . content . children . find (
Original file line number Diff line number Diff line change @@ -16,8 +16,14 @@ export const transformNodeToString = node => {
1616 return `**${ transformNodesToString ( node . children ) } **` ;
1717 case 'emphasis' :
1818 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+ }
2127 }
2228} ;
2329
You can’t perform that action at this time.
0 commit comments