(text: string)
| 260 | } |
| 261 | |
| 262 | export function findHeading(text: string): { text: string; heading: string } { |
| 263 | const lines = text.split("\n"); |
| 264 | const firstLineIdx = lines.findIndex(Boolean); |
| 265 | if (firstLineIdx === -1) return { text: "", heading: "" }; |
| 266 | const firstLineClean = RemoveMarkdown(lines[firstLineIdx]); |
| 267 | const isHeading = firstLineClean.length < 100; |
| 268 | |
| 269 | return { |
| 270 | // The <100 is to remove paragraphs after genuine empty headings |
| 271 | text: (isHeading ? lines.slice(firstLineIdx + 1) : lines).join("\n"), |
| 272 | heading: isHeading ? firstLineClean : "", |
| 273 | }; |
| 274 | } |
| 275 | |
| 276 | export function removeMDLinksImgs(text: string): string { |
| 277 | /** Remove Markdown doesn't remove links which are spread over multiple lines **/ |
no outgoing calls
no test coverage detected