(html: string, tagName: string)
| 130 | } |
| 131 | |
| 132 | function extractElementContents(html: string, tagName: string): string[] { |
| 133 | const matches = html.matchAll( |
| 134 | new RegExp(`<${tagName}\\b[^>]*>([\\s\\S]*?)<\\/${tagName}>`, 'gi'), |
| 135 | ) |
| 136 | return Array.from(matches, (match) => match[1]).filter(Boolean) |
| 137 | } |
| 138 | |
| 139 | function selectReadableHtml(html: string): string { |
| 140 | const articleCandidates = extractElementContents(html, 'article') |
no test coverage detected