* Serializes Quarto cell options to #| format lines.
(options: QuartoCellOptions)
| 124 | * Serializes Quarto cell options to #| format lines. |
| 125 | */ |
| 126 | function serializeQuartoCellOptions(options: QuartoCellOptions): string[] { |
| 127 | const lines: string[] = [] |
| 128 | |
| 129 | if (options.label) { |
| 130 | lines.push(`#| label: ${options.label}`) |
| 131 | } |
| 132 | if (options.echo !== undefined) { |
| 133 | lines.push(`#| echo: ${options.echo}`) |
| 134 | } |
| 135 | if (options.eval !== undefined) { |
| 136 | lines.push(`#| eval: ${options.eval}`) |
| 137 | } |
| 138 | if (options.output !== undefined) { |
| 139 | lines.push(`#| output: ${options.output}`) |
| 140 | } |
| 141 | if (options.figCap) { |
| 142 | lines.push(`#| fig-cap: "${options.figCap}"`) |
| 143 | } |
| 144 | if (options.figWidth !== undefined) { |
| 145 | lines.push(`#| fig-width: ${options.figWidth}`) |
| 146 | } |
| 147 | if (options.figHeight !== undefined) { |
| 148 | lines.push(`#| fig-height: ${options.figHeight}`) |
| 149 | } |
| 150 | if (options.tblCap) { |
| 151 | lines.push(`#| tbl-cap: "${options.tblCap}"`) |
| 152 | } |
| 153 | if (options.warning !== undefined) { |
| 154 | lines.push(`#| warning: ${options.warning}`) |
| 155 | } |
| 156 | if (options.message !== undefined) { |
| 157 | lines.push(`#| message: ${options.message}`) |
| 158 | } |
| 159 | |
| 160 | // Add raw options |
| 161 | if (options.raw) { |
| 162 | for (const [key, value] of Object.entries(options.raw)) { |
| 163 | if (typeof value === 'string') { |
| 164 | lines.push(`#| ${key}: "${value}"`) |
| 165 | } else { |
| 166 | lines.push(`#| ${key}: ${value}`) |
| 167 | } |
| 168 | } |
| 169 | } |
| 170 | |
| 171 | return lines |
| 172 | } |
| 173 | |
| 174 | /** |
| 175 | * Converts a Deepnote project file into separate Quarto (.qmd) files. |
no outgoing calls
no test coverage detected