Markdown Linebreak in Hugo
My primary website uses Hugo for a variety of reasons and for the most part, I love it…except when you run into odd edge-cases and the latest one: line-breaks using Markdown aka the <br />
tag.
After a little bit of research, I ended up creating a custom shortcode to handle the need / issue, naming it “line-break.html”:
![shortcodes.png List of html files under the layouts / shortcodes directory structure.](https://cdn.uploads.micro.blog/8317/2023/shortcodes.png)
To use the shortcode, I add [[< line-break >]]
(I used regular brackets here, instead of curly ones, so this shortcode wouldn’t trip up Hugo) into my various markdown files and voila: line-breaks in the generated HTML!
![linebreaks.png Screen grab of text, showing the newly created line-break tag at the end of each line.](https://cdn.uploads.micro.blog/8317/2023/linebreaks.png)