(html, maxLength = 300)
| 293 | } |
| 294 | |
| 295 | function simplifyHtmlElement(html, maxLength = 300) { |
| 296 | try { |
| 297 | html = removeNonInteractiveElements(html) |
| 298 | html = html.replace(/<html>(?:<head>.*?<\/head>)?<body>(.*)<\/body><\/html>/s, '$1').trim() |
| 299 | } catch (e) { |
| 300 | // keep raw html if minification fails |
| 301 | } |
| 302 | if (html.length > maxLength) { |
| 303 | html = html.slice(0, maxLength) + '...' |
| 304 | } |
| 305 | return html |
| 306 | } |
| 307 | |
| 308 | async function formatHtml(html) { |
| 309 | let processed = html |
no test coverage detected