diff --git a/cli/src/osf.ts b/cli/src/osf.ts
index 91ecb7d..27f1519 100644
--- a/cli/src/osf.ts
+++ b/cli/src/osf.ts
@@ -12,6 +12,8 @@ import {
SheetBlock,
OSFValue,
TextRun,
+ ContentBlock,
+ Paragraph,
} from 'omniscript-parser';
// Type definitions for formula handling
@@ -45,6 +47,70 @@ function extractText(run: TextRun): string {
return '';
}
+// Helper function to render TextRun objects to HTML
+function renderTextRun(run: TextRun): string {
+ if (typeof run === 'string') {
+ return run;
+ }
+ if ('type' in run) {
+ switch (run.type) {
+ case 'link':
+ return `${run.text}`;
+ case 'image':
+ return ``;
+ }
+ }
+ if ('text' in run) {
+ let text = run.text;
+ if (run.bold) text = `${text}`;
+ if (run.italic) text = `${text}`;
+ if (run.underline) text = `${text}`;
+ return text;
+ }
+ return '';
+}
+
+// Render content blocks within slides to HTML
+function renderContentBlock(block: ContentBlock, indent = ' '): string {
+ switch (block.type) {
+ case 'paragraph': {
+ const text = block.content.map(renderTextRun).join('');
+ return `${indent}
${text}
`; + } + case 'unordered_list': { + const items = block.items + .map(item => `${indent}\n${inner}\n${indent}`; + } + case 'code': { + const langClass = block.language ? ` class="language-${block.language}"` : ''; + const escaped = block.content + .replace(/&/g, '&') + .replace(//g, '>'); + return `${indent}
${escaped}`;
+ }
+ case 'image': {
+ return `${indent}