also need to strip \r if we split on \n, otherwise the <pre> environment