Markdown table with class

Hello All

I am coming from Jekyll where one can have a table in markdown and html classes after, like
| X|Y|
{: .table }

That is apparently not possible in CommonMark used in Zola.

I have a lot of md with such tables. So my question is: is it possible to have a markdown table with class, or is is necessary to have it in html and import with shortcodes?

best, j

Unless [Feature Request] Allow custom HTML attributes to be inserted from within markdown content · Issue #606 · raphlinus/pulldown-cmark · GitHub is implemented it’s not going to be possible with just Markdown.
You can embed HTML in markdown directly, no need to have it in a shortcode. You can do something like

<div class="my-table">
{% table %}
| X|Y|
{% end %}
</div>

and have the shortcode render the markdown using the | markdown filter

1 Like

Thanks @keats for confirming what I feared.

yes, I had seen that GitHub request.

It is sad, and embedding a html table is super clumsy.

That said, a very clumsy workaround (but easy to code) is to have md in separate folder and have python automatically convert the md table to html with class and copy all to zola contents. Can even do that with life editing and fswatch. elegant it isnt.

all the best,

p.s. I got one site mostly done in zola and have 3 jekyll conversions to go. I think you have made the perfect ssg.

j

1 Like