(text)
| 47 | } |
| 48 | |
| 49 | function improvedCleanup(text) { |
| 50 | text = text.replace(/\n{3,}/g, '\n\n'); |
| 51 | |
| 52 | text = text.replace(/[ \t]+$/gm, ''); |
| 53 | |
| 54 | text = text.replace(/[ \t]{3,}/g, ' '); |
| 55 | |
| 56 | text = text.replace(/[ \t]*\n[ \t]*\n[ \t]*\n/g, '\n\n'); |
| 57 | |
| 58 | text = text.trim(); |
| 59 | |
| 60 | return text; |
| 61 | } |
| 62 | |
| 63 | console.log("=== ORIGINAL TEXT ==="); |
| 64 | console.log(JSON.stringify(testMarkdownWithExcessiveNewlines)); |
no outgoing calls
no test coverage detected