(content: ExtractedContent, options: ExportOptions)
| 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 | /** |
nothing calls this directly
no test coverage detected