processFinalDocument cleans up the final document by removing excessive newlines and headers.
(content string)
| 159 | |
| 160 | // processFinalDocument cleans up the final document by removing excessive newlines and headers. |
| 161 | func processFinalDocument(content string) string { |
| 162 | // Clean up excessive newlines and leftover headers |
| 163 | content = regexp.MustCompile(`\n{3,}`).ReplaceAllString(content, "\n\n") |
| 164 | return regexp.MustCompile(`(?m)^#+\s*$`).ReplaceAllString(content, "") |
| 165 | } |