(type: ArtifactType, content: string)
| 181 | * - text: shown in a <pre>. |
| 182 | */ |
| 183 | export function buildPreviewHtml(type: ArtifactType, content: string): string { |
| 184 | switch (type) { |
| 185 | case 'html': |
| 186 | return content; |
| 187 | case 'svg': |
| 188 | return htmlShell(`<div class="__art_center">${content}</div>`); |
| 189 | case 'react': |
| 190 | return reactHarness(content); |
| 191 | case 'vue': |
| 192 | return vueHarness(content); |
| 193 | case 'markdown': |
| 194 | return markdownHarness(content); |
| 195 | case 'text': |
| 196 | default: |
| 197 | return htmlShell(`<pre class="__art_text">${escapeHtml(content)}</pre>`); |
| 198 | } |
| 199 | } |
| 200 | |
| 201 | /** The filename the preview is written as, inside the artifact's version folder. */ |
| 202 | export const PREVIEW_FILE = '__preview__.html'; |
no test coverage detected