(attrsString: string)
| 463 | |
| 464 | // Extract and preserve allowed attributes from HTML heading tags |
| 465 | function extractHeadingAttrs(attrsString: string): string { |
| 466 | if (!attrsString) return '' |
| 467 | const preserved: string[] = [] |
| 468 | const alignMatch = /\balign=(["']?)([^"'\s>]+)\1/i.exec(attrsString) |
| 469 | if (alignMatch?.[2]) { |
| 470 | preserved.push(`align="${alignMatch[2]}"`) |
| 471 | } |
| 472 | return preserved.length > 0 ? ` ${preserved.join(' ')}` : '' |
| 473 | } |
| 474 | |
| 475 | export async function renderReadmeHtml( |
| 476 | content: string, |