@@ -106,6 +106,66 @@ function formatJsxProp(key: string, value: unknown): string {
106106 return `${ key } ={${ JSON . stringify ( value , null , 2 ) } }` ;
107107}
108108
109+ // Helper to wrap long CLI commands for better readability
110+ function wrapCliCommand ( command : string , maxLength = 80 ) : string {
111+ // If command is short enough, return as-is
112+ if ( command . length <= maxLength ) {
113+ return command ;
114+ }
115+
116+ // Split the command into base command and arguments
117+ const parts = command . split ( / \s + / ) ;
118+ if ( parts . length <= 2 ) {
119+ // Very simple command, no wrapping needed
120+ return command ;
121+ }
122+
123+ // Find the base command (everything before the first --)
124+ let baseCommandEnd = 0 ;
125+ for ( let i = 0 ; i < parts . length ; i ++ ) {
126+ if ( parts [ i ] . startsWith ( "--" ) ) {
127+ baseCommandEnd = i ;
128+ break ;
129+ }
130+ }
131+
132+ // If no -- arguments found, return as-is
133+ if ( baseCommandEnd === 0 ) {
134+ return command ;
135+ }
136+
137+ const baseCommand = parts . slice ( 0 , baseCommandEnd ) . join ( " " ) ;
138+ const lines : string [ ] = [ baseCommand ] ;
139+ let currentLine = "" ;
140+
141+ // Process arguments
142+ for ( let i = baseCommandEnd ; i < parts . length ; i ++ ) {
143+ const part = parts [ i ] ;
144+
145+ if ( part . startsWith ( "--" ) ) {
146+ // This is a flag, potentially start a new line
147+ if ( currentLine ) {
148+ lines . push ( currentLine ) ;
149+ currentLine = "" ;
150+ }
151+ currentLine = ` ${ part } ` ;
152+ } else {
153+ // This is a value or continuation of the previous token
154+ currentLine += ` ${ part } ` ;
155+ }
156+ }
157+
158+ // Add the last line
159+ if ( currentLine ) {
160+ lines . push ( currentLine ) ;
161+ }
162+
163+ // Join with backslashes (except the last line)
164+ return lines
165+ . map ( ( line , i ) => ( i < lines . length - 1 ? `${ line } \\` : line ) )
166+ . join ( "\n" ) ;
167+ }
168+
109169// Read all partial files
110170const partialFiles = await glob ( "docs/cli/*.partial.mdx" , { cwd : projectDir } ) ;
111171const partialContent : Record < string , string > = { } ;
@@ -197,7 +257,12 @@ async function createCommandPage(
197257 }
198258
199259 if ( command . examples && command . examples . length > 0 ) {
200- props . push ( formatJsxProp ( "examples" , command . examples ) ) ;
260+ // Wrap long commands for better readability
261+ const wrappedExamples = command . examples . map ( ( [ cmd , desc ] ) => [
262+ wrapCliCommand ( cmd ) ,
263+ desc ,
264+ ] ) ;
265+ props . push ( formatJsxProp ( "examples" , wrappedExamples ) ) ;
201266 }
202267
203268 if ( command . usage ) {
0 commit comments