(page, index, source = "")
| 120 | } |
| 121 | |
| 122 | function finalizePage(page, index, source = "") { |
| 123 | const start = Math.max(0, Number(page.start || 0)); |
| 124 | const end = Math.max(start, Number(page.end ?? String(source || "").length)); |
| 125 | const markdown = String(source || "").slice(start, end) || page.lines.join("\n"); |
| 126 | return { |
| 127 | index, |
| 128 | title: page.title, |
| 129 | level: page.level, |
| 130 | anchor: slugifyHeading(page.title), |
| 131 | start, |
| 132 | end, |
| 133 | markdown, |
| 134 | }; |
| 135 | } |
| 136 | |
| 137 | function cleanHeadingText(text = "") { |
| 138 | return String(text || "") |
no test coverage detected