Automatically remove empty list elements and empty headers

E.g., '\n*\n' would be removed. Should counteract a601506.