MCPcopy Create free account
hub / github.com/experdot/pointer / convert

Function convert

src/renderer/src/features/export/plugins/formats/htmlFormat.ts:16–50  ·  view source on GitHub ↗
(content: ExtractedContent, options: ExportOptions)

Source from the content-addressed store, hash-verified

14 mimeType: 'text/html',
15
16 async convert(content: ExtractedContent, options: ExportOptions): Promise<ConvertResult> {
17 let html: string
18
19 switch (content.contentType) {
20 case 'messages':
21 html = convertMessagesToHtml(content, options)
22 break
23
24 case 'text':
25 html = wrapInHtml(escapeHtml(content.rawContent).replace(/\n/g, '<br>'), 'Text Export')
26 break
27
28 case 'code':
29 html = wrapInHtml(
30 `<pre><code class="language-${content.language || 'text'}">${escapeHtml(content.rawContent)}</code></pre>`,
31 'Code Export'
32 )
33 break
34
35 case 'table':
36 html = wrapInHtml(markdownTableToHtml(content.rawContent), 'Table Export')
37 break
38
39 default:
40 html = wrapInHtml(escapeHtml(content.rawContent), 'Export')
41 }
42
43 return {
44 content: html,
45 preview: html,
46 isBinary: false,
47 extension: 'html',
48 mimeType: 'text/html'
49 }
50 }
51}
52
53/**

Callers

nothing calls this directly

Calls 4

convertMessagesToHtmlFunction · 0.85
wrapInHtmlFunction · 0.85
escapeHtmlFunction · 0.85
markdownTableToHtmlFunction · 0.85

Tested by

no test coverage detected