Create a table without a header in Markdown

后端 未结 11 2025
有刺的猬
有刺的猬 2021-01-30 07:42

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

The HTML would look like this:



        
                      
相关标签:
11条回答
  • 2021-01-30 08:10

    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.

    0 讨论(0)
  • 2021-01-30 08:16

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

    []()  | 
    ------|------
    Row 1 | row 2
    
    0 讨论(0)
  • 2021-01-30 08:18

    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  |
    
    0 讨论(0)
  • 2021-01-30 08:18

    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.

    0 讨论(0)
  • 2021-01-30 08:22

    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.

    0 讨论(0)
  • 2021-01-30 08:27

    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/editor

    It worked with GitLab/GitHub's Markdown implementations.

    0 讨论(0)
提交回复
热议问题