I’m in the process of converting a Wordpress blog to use hugo instead. Many of my posts are code related and make use of client side syntax highlighting in code blocks. However one of my posts is basically in the form of a poem, and I would like linebreaks to be retained, but code blocks don’t give the presentation I’m looking for, and they also try to auto-highlight the text which definitely isn’t what I want. In Wordpress it basically did this for me, by inserting
<br/> at the end of each line. What I’d like is basically this:
I went for a walk.
And then some stuff happened.
And then I went home.
Interestingly, this discussion forum appears to do exactly what I want without doing anything special.
I could of course just add
<br/> to the end of each line manually, or apparently use the markdown “two or more spaces at the end of the line” to mean the same thing, but is there a shortcode I could use (or create) which would format the text block this way for me automatically? Can I iterate through input lines in a shortcode and replace line endings with the required markup? Or is there some CSS I could wrap the block in to achieve the same presentation?