* Splits markdown content at cell delimiter comments and adds each part as a separate cell. * The delimiter `<!-- cell -->` is used to preserve cell boundaries during roundtrip conversion.
(cells: QuartoCell[], content: string)
| 124 | * The delimiter `<!-- cell -->` is used to preserve cell boundaries during roundtrip conversion. |
| 125 | */ |
| 126 | function addMarkdownCells(cells: QuartoCell[], content: string): void { |
| 127 | // Split at cell delimiter, preserving cell boundaries |
| 128 | const parts = content.split(/\s*<!--\s*cell\s*-->\s*/) |
| 129 | for (const part of parts) { |
| 130 | const trimmed = part.trim() |
| 131 | if (trimmed) { |
| 132 | cells.push({ |
| 133 | cellType: 'markdown', |
| 134 | content: trimmed, |
| 135 | }) |
| 136 | } |
| 137 | } |
| 138 | } |
| 139 | |
| 140 | /** |
| 141 | * Parses YAML frontmatter string into a QuartoFrontmatter object. |