Insert newlines correctly when splitting literal blocks

Fixes #9274