MCPcopy Create free account
hub / github.com/QodeXcli/QodeX / buildPreviewHtml

Function buildPreviewHtml

src/artifacts/preview.ts:183–199  ·  view source on GitHub ↗
(type: ArtifactType, content: string)

Source from the content-addressed store, hash-verified

181 * - text: shown in a <pre>.
182 */
183export 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. */
202export const PREVIEW_FILE = '__preview__.html';

Callers 3

executeMethod · 0.85
renderCurrentFunction · 0.85

Calls 5

htmlShellFunction · 0.85
reactHarnessFunction · 0.85
vueHarnessFunction · 0.85
markdownHarnessFunction · 0.85
escapeHtmlFunction · 0.70

Tested by

no test coverage detected