Text Formatting and Color in Markdown Tables
By MarkdownTables.com editorial teamUpdated
On this page
How do I format text in a Markdown table cell?
A table cell takes any inline Markdown, exactly as in a paragraph. Block syntax (lists, headings, code fences) doesn't fit in a cell; see line breaks and lists in cells for the workarounds.
Renders the same on GitHub, GitLab, Obsidian, VS Code and other GFM renderers.
Open in editor : Inline formatting inside cellsReference-style links ([Docs][docs]) and bare URLs also work; put the [docs]: https://… definition outside the table. If a value contains a pipe, escape it as \|, even inside backticks (see escaping pipes).
Formatting syntax reference
| Effect | Syntax | GitHub | Notes |
|---|---|---|---|
| Bold | **text** or __text__ | ✅ | Header cells are already bold |
| Italic | *text* or _text_ | ✅ | _ inside words (snake_case) is left alone |
| Strikethrough | ~~text~~ | ✅ | GitHub also accepts a single ~ |
| Inline code | Backticks: npm test | ✅ | Escape pipes inside as \| |
| Link | [text](https://…) | ✅ | Bare URLs are autolinked |
| Subscript / superscript | <sub> / <sup> | ✅ | Pandoc: ~sub~, ^sup^ |
| Keyboard key | <kbd>Ctrl</kbd> | ✅ | |
| Underline | <ins>text</ins> | ✅ | No Markdown syntax for underline |
| Colored text | $\color{red}{\text{…}}$ | ⚠️ Math only | style and <font> are stripped |
| Cell or row background | CSS or <tr style> | ❌ | Only where styles are allowed |
| Font size | <sub> for smaller text; CSS | ⚠️ | No size syntax in Markdown |
Subscript, superscript, keys and underline
GitHub allows a short list of inline HTML tags in cells. These four cover most needs that Markdown itself can't:
<sub>, <sup>, <kbd> and <ins> in cellsWorks on GitHub, GitLab, Obsidian and VS Code. Renderers that escape HTML show the tags as text.
Open in editor : <sub>, <sup>, <kbd> and <ins> in cellsHow do I color text in a Markdown table?
This is where platforms differ most. GitHub sanitizes HTML: it removes every style attribute and the <font> tag, so <span style="color:red"> renders as plain black text. Pick the method by where the table will be read.
On GitHub: math, emoji or badges
GitHub renders $…$ as math, and math supports \color. Wrap the words in \text{…} so spaces are kept:
| Check | Result |
| ----- | ------------------------------------- |
| Lint | $\color{green}{\text{Passed}}$ |
| Tests | $\color{red}{\text{Failed (3)}}$ |
| Build | $\color{orange}{\text{Skipped}}$ || Check | Result |
|---|---|
| Lint | Passed |
| Tests | Failed (3) |
| Build | Skipped |
Preview approximates GitHub’s output. Text is set in the math font, can’t contain links or a |, and some colors are hard to read in dark mode.
Math color is a workaround, not formatting: the font changes, links won't work inside it, and screen readers may read it as an equation. For status columns, colored emoji are simpler and work everywhere, including chat apps:
| Service | Status |
| -------- | -------------- |
| API | 🟢 Operational |
| Search | 🟡 Degraded |
| Billing | 🔴 Outage || Service | Status |
|---|---|
| API | 🟢 Operational |
| Search | 🟡 Degraded |
| Billing | 🔴 Outage |
shields.io badges give you a colored label with readable text. They are images, so they also work on GitHub (more in images and badges):
| Package | Status |
| ------- | ------ |
| core |  |
| plugins |  |
| legacy |  || Package | Status |
|---|---|
| core | |
| plugins | |
| legacy |
Where HTML styles are allowed
VS Code's preview, Obsidian and most static site generators (MkDocs, Docusaurus, Jekyll, Hugo with unsafe enabled) keep inline styles, so a <span> works:
style on a span| Service | Status |
| ------- | ------ |
| API | <span style="color:#15803d">Operational</span> |
| Billing | <span style="color:#b91c1c">Outage</span> || Service | Status |
|---|---|
| API | <span style="color:#15803d">Operational</span> |
| Billing | <span style="color:#b91c1c">Outage</span> |
GitHub strips the style attribute and shows plain text. Our preview does the same.
GitLab, Pandoc and kramdown
GitLab shows a color swatch next to a hex, RGB() or HSL() value written in backticks, which is handy for design-token tables:
| Token | Value |
| ------------ | ---------- |
| Primary | `#0369A1` |
| Danger | `#B91C1C` || Token | Value |
|---|---|
| Primary | #0369A1 |
| Danger | #B91C1C |
GitLab adds a swatch next to each value; other renderers show plain code.
Open in editor : GitLab color chipsPandoc and Quarto accept bracketed spans with attributes (HTML output). kramdown, used by Jekyll and GitHub Pages, adds attributes with an inline attribute list after a span:
| Service | Status |
| ------- | -------------------------------- |
| Billing | [Outage]{style="color:#b91c1c"} || Service | Status |
| ------- | ----------------------------------- |
| Billing | *Outage*{: style="color:#b91c1c"} |Row, cell and header background color
Pipe syntax has no way to address a row, a cell or the header, so background and border colors always come from CSS or an HTML table. None of these work on GitHub, which removes styles and class attributes.
Whole-site styling is the clean option: one stylesheet rule colors every table header, stripes rows and sets border colors. Adjust the selector to your theme (.md-typeset in MkDocs Material, .markdown in Docusaurus):
/* Site stylesheet: header background, zebra rows, border color */
.markdown-body table thead th {
background: #e0f2fe;
color: #0c4a6e;
}
.markdown-body table tbody tr:nth-child(even) {
background: #f8fafc;
}
.markdown-body table th,
.markdown-body table td {
border-color: #cbd5e1;
}One table only: in kramdown, attach a class with an attribute list on the line after the table, then target .status-table in CSS. In Obsidian, add a CSS snippet under Settings → Appearance.
| Service | Status |
| ------- | ------- |
| API | Up |
| Billing | Down |
{: .status-table}One row or cell: only an HTML table can do it, by putting style on the <tr> or <td>. A <span style="background:…"> inside a pipe-table cell highlights the text only, not the cell.
<table>
<tr style="background:#e0f2fe">
<th>Service</th><th>Status</th>
</tr>
<tr>
<td>API</td><td>Operational</td>
</tr>
<tr style="background:#fee2e2">
<td>Billing</td><td>Outage</td>
</tr>
</table>Bold headers, bold rows and bold columns
Header cells render as <th>, which are bold by default, so a “bold header” needs no markup. Wrapping header text in ** is harmless and helps only in themes that unbold headers:
| **Name** | **Role** |
| -------- | -------- |
| Ada | Engineer || Name | Role |
|---|---|
| Ada | Engineer |
Emphasis can't cross a pipe, so a bold row, such as a totals line, needs ** around each cell. The same goes for a bold first column.
| Region | Q1 | Q2 |
| ------- | -----: | -----: |
| EU | 1.2M | 1.4M |
| US | 2.1M | 2.3M |
| **Total** | **3.3M** | **3.7M** || Region | Q1 | Q2 |
|---|---|---|
| EU | 1.2M | 1.4M |
| US | 2.1M | 2.3M |
| Total | 3.3M | 3.7M |
Formatting and color support by platform
| Platform | Bold, italic, strike, code | <sub> <sup> <kbd> | Colored text | Row / cell background |
|---|---|---|---|---|
GitHub (GFM)Strips style attributes and <font>. | Yes | Yes | Partly: Math \color, emoji, badges | No |
| GitLab (GLFM)Hex, RGB and HSL values in inline code show a color chip. | Yes | Yes | Partly: Math \color, color chips | No |
| Obsidian | Yes | Yes | Yes: <span style> | Partly: CSS snippet |
| VS Code preview | Yes | Yes | Yes: <span style> | Partly: HTML table with style |
Pandoc / QuartoPandoc also has native ~sub~ and ^sup^. | Yes | Yes | Yes: [text]{style=…} (HTML output) | Partly: CSS (HTML output) |
MkDocs / Docusaurus / Hugo / JekyllHugo needs markup.goldmark.renderer.unsafe: true for raw HTML. | Yes | Yes | Yes: Inline HTML or kramdown IAL | Yes: Site CSS |
| NotionMarkdown is converted on paste; colors are set in Notion afterwards. | Partly: Converted on paste | No | Yes: Notion color menu | Yes: Notion color menu |
| Yes | Partly: ^ superscript only | No | No |
✅ supported · ⚠️ partly or with a workaround · ❌ not supported · Last verified October 2026
Common mistakes and fixes
Emphasis that crosses a pipe
Cells are split before emphasis is parsed, so ** opened in one cell can't close in the next. The asterisks show up as text.
| Status | Owner |
| ------------ | ----- |
| **Blocked | Ada** || Status | Owner |
|---|---|
| **Blocked | Ada** |
| Status | Owner |
| ----------- | ------- |
| **Blocked** | **Ada** || Status | Owner |
|---|---|
| Blocked | Ada |
Accidental strikethrough from tildes
GitHub treats a pair of single tildes as strikethrough, so ranges written with a tilde, such as “10~20 ms, 30~40 ms”, may come out partly struck through. Escape them as \~ or write the range with a dash.
| Endpoint | Latency |
| -------- | ------------------ |
| /search | 10~20 ms, 30~40 ms || Endpoint | Latency |
| -------- | -------------------- |
| /search | 10\~20 ms, 30\~40 ms || Endpoint | Latency |
|---|---|
| /search | 10~20 ms, 30~40 ms |
Stray asterisks and underscores
Values like 5 * 3 * 2 or *.log in two places can turn into italics. Escape the asterisk (\*) or put the value in backticks. The table validator catches unclosed code spans and unescaped pipes.
Colors that vanish on GitHub
<font color>, <span style> and <td bgcolor> all render as plain text on GitHub. If the table lives in a README, switch to math color, emoji or badges.
When to switch to HTML or CSS
Formatting individual words is fine in Markdown. Move to an HTML table, or to CSS on your site, when you need background colors, borders, per-row styles or font sizes, and the renderer allows it. On GitHub, no amount of HTML brings back styles; use icons and badges and keep the table plain.
The Markdown to HTML converter produces a table you can add styles to. For everything else about table structure, see Markdown table syntax; for status columns, see checkboxes and status icons, and for colored math, see math in tables.
Frequently asked questions
How do I change the text color in a Markdown table on GitHub?
Use inline math: $\color{red}{\text{Failed}}$ renders red text in a GitHub table cell. GitHub strips style attributes and <font> tags, so HTML colors don’t work. Emoji (🟢 🔴) and shields.io badges are the other GitHub-safe options.
How do I color a row in a Markdown table?
Markdown has no row syntax for color. On a site you control, use CSS such as tbody tr:nth-child(even) { background: #f8fafc; }, or write the table in HTML with <tr style="background:…"> where styles are allowed. GitHub removes both, so there you can only color text.
How do I change the header color of a Markdown table?
With CSS: thead th { background: #e0f2fe; color: #0c4a6e; } in your site or editor stylesheet. Pipe syntax has no header color option, and GitHub ignores styles. On GitHub, the closest you can get is a math-colored or emoji-prefixed header label.
How do I make the header of a Markdown table bold?
It already is: header cells render as <th>, which browsers and most themes show in bold. If your theme doesn’t, wrap each header in **…**. To bold a whole data row, bold each cell separately, because emphasis can’t span pipes.
Can I use bold and italic in a Markdown table?
Yes. **bold**, *italic*, ***bold italic***, ~~strikethrough~~, inline code and links all work inside cells on GitHub, GitLab, Obsidian and other GFM renderers. Each span must open and close inside the same cell.
Can I change the font size in a Markdown table?
Not with Markdown. On GitHub, <sub> or <sup> make text smaller. On a site you control, set font-size on table or td in CSS. Inline style works in VS Code preview and Obsidian but is stripped on GitHub.
Do footnotes work inside Markdown table cells?
On GitHub, yes: a footnote reference such as [^1] works in a cell, with the footnote text defined below the table. The definition itself can’t go inside the table. Support elsewhere depends on whether the renderer has footnotes at all.
Format and line up a table you’ve already written.
Open the table formatter