Markdown table rendered by Hugo includes invalid HTML

  • I searched and could not find a related thread or GitHub issue.

Not sure if this is a feature or problem, hence this thread.

When I make a centred table like this:

Example | Table
------- | :-----:
Hello | there
this | is
an | example

Then Hugo 0.51 renders that into the following HTML:

<th align="center">Table</th>

<td align="center">there</td>

<td align="center">is</td>

<td align="center">example</td>

If I am to believe the official W3C HTML validator then this is invalid HTML. I get complaints about:

Error : The align attribute on the td element is obsolete. Use CSS instead.

Can we fix this? I’d love to have my markup to be valid.

1 Like

Hugo uses Blackfriday for markdown, so if you open an issue, I think it makes sense to open it there.

Don’t center the second column. And add a CSS code like:

td + td { align: center: }
1 Like

Okay, thanks. Make the issue here. :slight_smile:

1 Like

If you cannot pass through CSS, you can still use ReplaceRE to replace all td align=“center” to td style=“text-align: center”.

See my post here : How to Customise Tables