Hah nice! And shorter! and with regex! This is super elegant.
Not sure about edge cases but I'll give it a go and let you know. On a first look, your undo gets rid of one of my annoyances, which is that my solution was reformatting code blocks too, which you might want to leave untouched.
It also doesn't rely on where you are on the file. Mine was breaking if I was on the bottom line.
So far yours def wins in my book. Making it more worth having shared my solution. Thanks!
Ahh I didn't think about code blocks really. Mine is gonna single line all codeblocks I think lol Which probably isn't the best!
So that's at least one edge case to think about!
Thanks again for the fun post, I enjoyed it haha
We're a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.