DEV Community

Stephanie Baltus
Stephanie Baltus

Posted on

3 3

Hugo.io - Multiline cells in a table

A problem

Building table in markdown is super easy and well-documented.

However, having a bit of formatting within it, like carriage return within a cell as below is not possible by default.

multiline-cell
Hugo uses Goldmark (a CommonMark implementation in Go) to process the markdown. Apparently it's extremely fast, with this implementation we choose to block any HTML processing d'HTML by default.

A solution

Once you know this, solving this is pretty straightforward.

You can customize plenty of Goldmark options in the configuration file (config.toml/yaml/json).
So what we want to do is autorising Goldmark to render HTML content :

[markup.goldmark]
    [markup.goldmark.renderer]
    unsafe = true 
Enter fullscreen mode Exit fullscreen mode

From now, within the table, we just need to add <br> tag as below :

|Adresse | Parking de La Poste<br> Le Bourg <br>97122 Baie-Mahault |
Enter fullscreen mode Exit fullscreen mode

That's it !

Free tips

If you don't want to bother with | when building tables, someone very nice has built a table generator.

We thank this person, from the bottom of our heart πŸ’œ.

Image of AssemblyAI

Automatic Speech Recognition with AssemblyAI

Experience near-human accuracy, low-latency performance, and advanced Speech AI capabilities with AssemblyAI's Speech-to-Text API. Sign up today and get $50 in API credit. No credit card required.

Try the API

Top comments (0)

AWS Security LIVE!

Tune in for AWS Security LIVE!

Join AWS Security LIVE! for expert insights and actionable tips to protect your organization and keep security teams prepared.

Learn More

πŸ‘‹ Kindness is contagious

Discover a treasure trove of wisdom within this insightful piece, highly respected in the nurturing DEV Community enviroment. Developers, whether novice or expert, are encouraged to participate and add to our shared knowledge basin.

A simple "thank you" can illuminate someone's day. Express your appreciation in the comments section!

On DEV, sharing ideas smoothens our journey and strengthens our community ties. Learn something useful? Offering a quick thanks to the author is deeply appreciated.

Okay