I'm trying to generate a table in markdown without column headers, every sample that I found on the internet uses column headers. The table that I want is M x 2
.
Parsers that do support tables without headers. Text::MultiMarkdown: Perl CPAN module. MultiMarkdown: Windows application. ParseDown Extra: A parser in PHP. Flexmark: A parser in Java.
Tables. To add a table, use three or more hyphens ( --- ) to create each column's header, and use pipes ( | ) to separate each column. For compatibility, you should also add a pipe on either end of the row.
<th> elements aren't required anywhere. They're simply one of the two cell types (the other being <td> ) that you can use in a table row.
Vanilla Markdown doesn't support tables - instead, Gruber recommends using HTML tables inside a Markdown page (see the example on that page). That's one option.
If you're using some kind of extended Markdown syntax (MultiMarkdown, kramdown, Markdown Extra, etc.), then it depends on what you're using. According to the documentation for Markdown Extra, MultiMarkdown, and presumably, other extensions based on PHP Markdown Extra, tables without headers aren't possible, and you would have to write such a table in raw HTML as in vanilla Markdown. I can't find syntax documentation for Mou, but I would guess that it similarly doesn't support headerless tables. However, in kramdown, simply creating a table without a header row works:
| A1 | B1 |
| A2 | B2 |
You wouldn't be able to use a separator line, as that will cause kramdown to misinterpret everything above the separator as the header, but you should be able to create simple tables in this way.
Another option is to use the empty-cells
CSS property, thus hiding the empty header. Put the following in your general.css
:
table {
empty-cells: hide;
}
Assuming you want to continue using Mou, I think this would be the easiest way to have Markdown tables without doing some sort of post-processing of the HTML output.
Incidentally, this question is a duplicate of Create table without header in markdown, but I lack the reputation to either flag or mark it as such; apologies.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With