@@ -31,8 +31,9 @@ const commands: CliCommand[] = [
3131 } ,
3232 {
3333 name : 'render' ,
34- description : 'Render OSF to HTML output' ,
35- usage : 'osf render <file> [--format <html>] [--output <file>]' ,
34+ description : 'Render OSF to various output formats' ,
35+ usage :
36+ 'osf render <file> [--format <html|pdf|docx|pptx|xlsx>] [--output <file>]' ,
3637 args : [ 'file' ] ,
3738 } ,
3839 {
@@ -71,6 +72,7 @@ function showHelp(): void {
7172 console . log ( '\nExamples:' ) ;
7273 console . log ( ' osf parse document.osf' ) ;
7374 console . log ( ' osf render slides.osf --format html' ) ;
75+ console . log ( ' osf render slides.osf --format pdf' ) ;
7476 console . log ( ' osf export data.osf --target md --output output.md' ) ;
7577}
7678
@@ -223,6 +225,31 @@ function renderHtml(doc: OSFDocument): string {
223225 return parts . join ( '\n' ) ;
224226}
225227
228+ // Basic stubs for additional formats
229+ function renderPdf ( doc : OSFDocument ) : string {
230+ void doc ; // placeholder usage
231+ // TODO: real PDF rendering
232+ return 'PDF rendering not implemented.' ;
233+ }
234+
235+ function renderDocx ( doc : OSFDocument ) : string {
236+ void doc ;
237+ // TODO: real DOCX rendering
238+ return 'DOCX rendering not implemented.' ;
239+ }
240+
241+ function renderPptx ( doc : OSFDocument ) : string {
242+ void doc ;
243+ // TODO: real PPTX rendering
244+ return 'PPTX rendering not implemented.' ;
245+ }
246+
247+ function renderXlsx ( doc : OSFDocument ) : string {
248+ void doc ;
249+ // TODO: real XLSX rendering
250+ return 'XLSX rendering not implemented.' ;
251+ }
252+
226253function exportMarkdown ( doc : OSFDocument ) : string {
227254 const out : string [ ] = [ ] ;
228255
@@ -418,8 +445,22 @@ function main(): void {
418445 case 'html' :
419446 output = renderHtml ( doc ) ;
420447 break ;
448+ case 'pdf' :
449+ output = renderPdf ( doc ) ;
450+ break ;
451+ case 'docx' :
452+ output = renderDocx ( doc ) ;
453+ break ;
454+ case 'pptx' :
455+ output = renderPptx ( doc ) ;
456+ break ;
457+ case 'xlsx' :
458+ output = renderXlsx ( doc ) ;
459+ break ;
421460 default :
422- throw new Error ( `Unknown format: ${ format } . Supported: html` ) ;
461+ throw new Error (
462+ `Unknown format: ${ format } . Supported: html, pdf, docx, pptx, xlsx`
463+ ) ;
423464 }
424465
425466 if ( outputFile ) {
0 commit comments