(markdown: string)
| 158 | * Convert markdown text to HTML for PDF export |
| 159 | */ |
| 160 | const convertMarkdownToHTML = (markdown: string): string => { |
| 161 | return markdown |
| 162 | .replace(/^# (.*$)/gim, '<h1 style="font-size: 18px; font-weight: bold; margin: 10px 0; color: #000;">$1</h1>') |
| 163 | .replace(/^## (.*$)/gim, '<h2 style="font-size: 16px; font-weight: bold; margin: 8px 0; color: #000;">$1</h2>') |
| 164 | .replace(/^### (.*$)/gim, '<h3 style="font-size: 14px; font-weight: bold; margin: 6px 0; color: #000;">$1</h3>') |
| 165 | .replace(/\*\*(.*?)\*\*/g, '<strong style="font-weight: bold;">$1</strong>') |
| 166 | .replace(/\*(.*?)\*/g, '<em style="font-style: italic;">$1</em>') |
| 167 | .replace(/`(.*?)`/g, '<code style="background-color: #f0f0f0; padding: 2px 4px; border-radius: 3px; font-family: monospace;">$1</code>') |
| 168 | .replace(/^- (.*$)/gim, '<li style="margin: 4px 0;">$1</li>') |
| 169 | .replace(/(\n|^)([^<\n].*?)(\n|$)/g, '<p style="margin: 8px 0; line-height: 1.4;">$2</p>') |
| 170 | .replace(/(<li.*?<\/li>)+/g, '<ul style="margin: 8px 0; padding-left: 20px;">$&</ul>'); |
| 171 | }; |
| 172 | |
| 173 | /** |
| 174 | * Generate HTML content for PDF export from notebook cells |
no outgoing calls
no test coverage detected