Support Tables without Header (hide empty header row)

Use case or problem

We often use tables without header. In Markdown this can be done by simply leaving the header cells empty.

|            |              |
|:-----------|:-------------|
|  Cell 1    |  Cell 2      |

Right now Obsidian displays these tables with an empty header row.
GitHub collapses an empty header row and displays it smaller.

Proposed solution

Detect if all header cells are empty (basically the header row only consists of " |" (space and “|”). If that is the case, hide the header row when rendering the table.

Current workaround (optional)

Some workarounds were explored in this thread: “Remove the table header” (I can’t include a link in this post)
But they are all unacceptable.

Related feature requests (optional)

  • Remove the table header - Help - Obsidian Forum
2 Likes
/* table header weigth in reading mode */
.markdown-preview-view {
  --table-header-weight: normal; /* bold/normal */
}

/* table header weigth in live preview */
.markdown-source-view {
  --table-header-weight: normal; /* bold/normal */
}

See CSS Editor community plugin

1 Like

That is not a solution as it removes the ability to have a table header. It should be possible to have tables with and without header.

You can manually use bold ** ⋯ ** to make the first row look like header row.

I know, but in markdown source this will display something as header, which then isn’t a header. This behavior is also not markdown compliant.

My wish goes for Obsidian to provide an integrated solution. Not looking for a hack. If there is a plugin enabling a clean behavior, that would work as well.

I’m not sure which resource you are referring to.

This is from https://github.github.com/gfm/#tables-extension-:

4.10 Tables (extension)

GFM enables the table extension, where an additional leaf block type is available.

A table is an arrangement of data with rows and columns, consisting of a single header row, a delimiter row separating the header from the data, and zero or more data rows.

Each row consists of cells containing arbitrary text, in which inlines are parsed, separated by pipes (|). A leading and trailing pipe is also recommended for clarity of reading, and if there’s otherwise parsing ambiguity. Spaces between pipes and cell content are trimmed. Block-level elements cannot be inserted in a table.

Inlines includes links, images, bold, italics, raw html and code spans (but not lists for example).
 
In html table headers are semantically denoted by <th> tags. In markdown there is no concept of tables without headers if https://github.github.com/gfm is used as a reference.