Create a table without a header in Markdown

MarkdownHtml TableMultimarkdown

Markdown Problem Overview


Is it possible to create a table without a header in Markdown?

The HTML would look like this:

<table>
<tr>
    <td>Key 1</td>
    <td>Value 1</td>
</tr>
<tr>
    <td>Key 2</td>
    <td>Value 2</td>
</tr>
</table>

Markdown Solutions


Solution 1 - Markdown

Most Markdown parsers don't support tables without headers. That means the separation line for headers is mandatory.

Parsers that do not support tables without headers

Parsers that do support tables without headers.

CSS solution

If you're able to change the CSS of the HTML output you can however leverage the :empty pseudo class to hide an empty header and make it look like there is no header at all.

Solution 2 - Markdown

If you don't mind wasting a line by leaving it empty, consider the following hack (it is a hack, and use this only if you don't like adding any additional plugins).

|   |   |
|---|---|
|__Bold Key__| Value1 |
| Normal Key | Value2 |

To view how the above one could look, copy the above and visit https://stackedit.io/app

It worked with GitLab/GitHub's Markdown implementations.

Solution 3 - Markdown

Universal Solution

Many of the suggestions unfortunately do not work for all Markdown viewers/editors, for instance, the popular Markdown Viewer Chrome extension, but they do work with iA Writer.

What does seem to work across both of these popular programs (and might work for your particular application) is to use HTML comment blocks ('<!-- -->'):

| <!-- -->    | <!-- -->    |
|-------------|-------------|
| Foo         | Bar         |

Like some of the earlier suggestions stated, this does add an empty header row in your Markdown viewer/editor. In iA Writer, it's aesthetically small enough that it doesn't get in my way too much.

Solution 4 - Markdown

I got this working with Bitbucket's Markdown by using a empty link:

[]()  | 
------|------
Row 1 | row 2

Solution 5 - Markdown

At least for the GitHub Flavoured Markdown, you can give the illusion by making all the non‑header row entries bold with the regular __ or ** formatting:

|Regular | text | in header | turns bold |
|-|-|-|-|
| __So__ | __bold__ | __all__ | __table entries__ |
| __and__ | __it looks__ | __like a__ | __"headerless table"__ |

Solution 6 - Markdown

Omitting the header above the divider produces a headerless table in at least Perl Text::MultiMarkdown and in FletcherPenney MultiMarkdown

|-------------|--------|
|**Name:**    |John Doe|
|**Position:**|CEO     |

See PHP Markdown feature request


Empty headers in PHP Parsedown produce tables with empty headers that are usually invisible (depending on your CSS) and so look like headerless tables.

|     |     |
|-----|-----|
|Foo  |37   |
|Bar  |101  |

Solution 7 - Markdown

The following works well for me in GitHub. The first row is no longer bolded as it is not a header:

<table align="center">
    <tr>
        <td align="center"><img src="docs/img1.png?raw=true" alt="some text"></td>
        <td align="center">Some other text</td>
        <td align="center">More text</td>
    </tr>
    <tr>
        <td align="center"><img src="docs/img2.png?raw=true" alt="some text"></td>
        <td align="center">Some other text 2</td>
        <td align="center">More text 2</td>
    </tr>
</table>

Check a sample HTML table without a header here.

Solution 8 - Markdown

You may be able to hide a heading if you can add the following CSS:

<style>
	th {
		display: none;
	}
</style>

This is a bit heavy-handed and doesn’t distinguish between tables, but it may do for a simple task.

Update

HTML output varies between Markdown editors, but if the table includes a thead element, you can target the empty header cells more specifically with:

thead th:empty {
	border: thin solid red !important;
	display: none;
}

This works if your header row contains no visible content. Spaces between the bars are OK.

Solution 9 - Markdown

$ cat foo.md
Key 1 | Value 1
Key 2 | Value 2

$ kramdown foo.md
<table>
  <tbody>
    <tr>
      <td>Key 1</td>
      <td>Value 1</td>
    </tr>
    <tr>
      <td>Key 2</td>
      <td>Value 2</td>
    </tr>
  </tbody>
</table>

Solution 10 - Markdown

I use <span> in the first column header:

 <span> |
---     |    ---
Value   |  Value
Value   |  Value

It creates an empty header with border, but with 1/2 the size.

Solution 11 - Markdown

what works in GitHub issue editor is

&nbsp; |&nbsp;
------ | ---
Foo    | Bar

But it does show an empty header

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionadiusView Question on Stackoverflow
Solution 1 - MarkdownadiusView Answer on Stackoverflow
Solution 2 - MarkdownThamme GowdaView Answer on Stackoverflow
Solution 3 - MarkdownTony BarganskiView Answer on Stackoverflow
Solution 4 - MarkdownStuart CampbellView Answer on Stackoverflow
Solution 5 - MarkdownTT--View Answer on Stackoverflow
Solution 6 - MarkdownRedGrittyBrickView Answer on Stackoverflow
Solution 7 - MarkdownDanielView Answer on Stackoverflow
Solution 8 - MarkdownManngoView Answer on Stackoverflow
Solution 9 - MarkdownZomboView Answer on Stackoverflow
Solution 10 - MarkdownLong-John SilverView Answer on Stackoverflow
Solution 11 - Markdowntheking2View Answer on Stackoverflow