Sometimes when you copy a new markdown, obsidian will paste some new lines. This is a solution based on templater plugin which resolves this issue.
First create a new file named remove-double-lines.md. Then paste this content into it:
<%*
app.vault.process(app.workspace.getActiveFile(), contents => contents.replace(/\n\s*\n/g, '\n'))
-%>
This basically removes all double newlines.
Credit: https://www.reddit.com/r/ObsidianMD/comments/1ga3hvo/comment/ltb6zwz
Original Pasted Content (which does that with two ‘\n\n’)
<%*
// Clean up multiple line breaks in a note
app.vault.process(app.workspace.getActiveFile(), contents => contents.replace(/\n\s*\n/g, '\n\n'))
-%>