Can Hugo generate HTML Tables from Markdown?

Hi,

I’m trying to generate a table list of items in markdown.

So far I have tried all of the variations of the table syntax for different flavors of markdown parsers without any success.

From what I understand Hugo is using the Blackfriday markdown parser. Am I correct?

If so, from the Blackfriday documentation the following markdown should results in a table:

Name Age
Bob 27
Alice 23

However, it do not and the text is rendered as you see above.

Can anyone point me in the right direction?

Thanks,
Richard

1 Like

Yes, by default. There are some others, including mmark.

Just tested it by pasting

Name    | Age
--------|------
Bob     | 27
Alice   | 23

Into one of my Hugo sites’ markdown files. Work fine.

2 Likes

D’oh!

That’s what I get for taking a co-workers word. You are correct, the tables are being generated.

Is there a way to change the Markdown parser?

You will have to use the built-ins – some depend on external tools, all of them gets triggered by file extension:

  • md > blackfriday
  • mmark > mmark
  • ad > asciidoc

This should be in the documentation.

2 Likes

Thanks bep!