Created
April 22, 2026 09:40
-
-
Save blackspike/3aec4db8c2629b05218e5498d4b1b848 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| { | |
| "api":1, | |
| "name":"Unwrap Paragraphs", | |
| "description":"Joins soft-wrapped lines into single lines, keeping paragraph breaks.", | |
| "author":"felix", | |
| "icon":"collapse", | |
| "tags":"unwrap,join,lines,paragraph,reflow,wrap" | |
| } | |
| **/ | |
| function main(input) { | |
| input.text = input.text | |
| .replace(/\r\n?/g, '\n') | |
| .split(/\n[ \t]*\n+/) | |
| .map(p => p.replace(/[ \t]*\n[ \t]*/g, ' ').trim()) | |
| .filter(p => p.length > 0) | |
| .join('\n\n'); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment