@@ -2,14 +2,6 @@ const path = require('path');
22const fs = require ( 'fs' ) ;
33const matter = require ( 'gray-matter' ) ;
44
5- const DOCS_URL = 'https://commandkit.dev/docs/next/guide' ;
6-
7- const removeNumericPrefix = ( path ) => {
8- // 01-getting-started/01-introduction -> getting-started/introduction
9- const segments = path . split ( '/' ) ;
10- return segments . map ( ( segment ) => segment . replace ( / ^ \d + \- / , '' ) ) . join ( '/' ) ;
11- } ;
12-
135module . exports = function ( context ) {
146 return {
157 name : 'llms-txt-plugin' ,
@@ -37,7 +29,7 @@ module.exports = function (context) {
3729 entry . name . endsWith ( '.md' )
3830 ) {
3931 const content = await fs . promises . readFile ( fullPath , 'utf8' ) ;
40- const { data : frontmatter } = matter ( content ) ;
32+ const { data : frontmatter , content : markdownContent } = matter ( content ) ;
4133
4234 // Get relative path from guide directory
4335 const relativePath = path
@@ -50,6 +42,7 @@ module.exports = function (context) {
5042 description : frontmatter . description ,
5143 path : relativePath ,
5244 version : versionPrefix ,
45+ content : markdownContent ,
5346 } ) ;
5447 }
5548 }
@@ -67,14 +60,13 @@ module.exports = function (context) {
6760
6861 // Generate markdown content
6962 const markdownContent = [
70- '# CommandKit Docs \n' ,
63+ '# CommandKit Documentation\n \n' ,
7164 ...allDocs
72- . filter ( ( doc ) => doc . title && doc . description )
65+ . filter ( ( doc ) => doc . title && doc . content )
7366 . map ( ( doc ) => {
74- const url = `${ DOCS_URL } /${ removeNumericPrefix ( doc . path ) } ` ;
75- return `- [${ doc . title } ](${ url } ): ${ doc . description || doc . title } ` ;
67+ return `## ${ doc . title } \n\n${ doc . content } \n\n---\n\n` ;
7668 } ) ,
77- ] . join ( '\n ' ) ;
69+ ] . join ( '' ) ;
7870
7971 // Write markdown content
8072 const llmsTxtPath = path . join ( outDir , 'llms.txt' ) ;
0 commit comments