Disable zebra striping in Github table markdown
Asked Answered
T

2

21

By default Tables in Github Markdown are rendered with alternate rows highlighted (zebra striped). What is the markdown to disable this feature? The Github markdown documentation for tables does not describe how this is done.

For example, this table has row striping:

enter image description here

The corresponding markdown is:

Key|Value
---|-----
A|B
C|D
E|F
G|H

This question is different from this question which talks about applying colors in markdown. This question relates specifically to the alternating row highlighting in tables.

Tray answered 12/5, 2018 at 1:45 Comment(3)
Possible duplicate of How to apply Color in markdownSoot
I don't believe this is possible with GitHub's markdown.Fretwork
Looking at the css, there is only one rule that sets .markdown-body table tr:nth-child(2n){ background-color:#f6f8fa } and nothing else that could possibly overwrite it. So I'd say it's a no-go.Policyholder
P
17

It's not possible with CSS, but there is a workaround. Just add an empty row between your rows.

<tr></tr>
Proselyte answered 23/9, 2020 at 9:7 Comment(5)
So hacky, but I love it.Beaton
1 trillion IQ..Dali
Can you give an example? If I put <tr></tr> in my markdown formatted table, the table outputs until <tr> and then no output.Territerrible
I'd love an example too. I'm not sure where to insert <tr></tr>. When I add the tr between rows it cuts out all of the rows below the tr.Pathognomy
It's so beautifulAnnelid
P
0

As you both asked for a example, here is snippet from a table i am constructing, note the <tr></tr>, this disables zebra striping.

| Description | YAML Path | Type | Values | Example |
| :---------- | :-------- | :--- | :----- | :------ |
| Absolute path to existing media | general/library | String | N/A | `library_path: '/media'` <tr></tr> |
| Daemonised mode | general/daemon_mode | String | 'foreground'\|'background' | `daemon_mode: 'foreground'` <tr></tr> |
Pewit answered 15/8, 2023 at 12:21 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.