11

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.

Radllaufer
  • 187
  • 1
  • 2
  • 10
LuisEspinoza
  • 8,508
  • 6
  • 35
  • 57
  • I could export the markdown to html and edit the table, but, a markdown solution is more elegant.. – LuisEspinoza Aug 28 '13 at 21:35
  • Which flavour of markdown are you using? 'pure' markdown lacks tables and the different extensions have different syntax / limitations. – Oliver Matthews Aug 29 '13 at 17:31
  • Hi @OliverMatthews, I´m using the Mou app for OS X. Browsing info about Markdown, I found that pure markdown lacks of tables. I have not found which flavour uses, but is not github or stackoverflow. – LuisEspinoza Aug 29 '13 at 17:44
  • I probably will use HTML code... – LuisEspinoza Aug 29 '13 at 17:45
  • 1
    Hmmm. Can't see obviously which markdown backend mou uses (not got access to a mac to try it). I know pandoc's markdown can do headless tables, I don't think mmd (which seems to be the more popular one for embedding in apps) does though. – Oliver Matthews Aug 29 '13 at 20:44
  • 3
    possible duplicate of [Create table without header in markdown](http://stackoverflow.com/questions/17536216/create-table-without-header-in-markdown) – RedGrittyBrick Feb 05 '15 at 17:20

2 Answers2

4

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.

Community
  • 1
  • 1
Kyle Barbour
  • 985
  • 8
  • 25
-4

You can just have the header be the first row. Ie:

Row 1 | Value 1
======|========
Row 2 | Value 2

or, for a consistent appearance

Row 1 | Value 1
:====:|:======:
**Row 2** | **Value 2**

It doesn't look great but it works

q335r49
  • 608
  • 8
  • 10