Remove newlines at the end of Markdown and list items