# markdown-it-table

> Plugin for markdown-it markdown parser, adding table with nested block syntax support.

Latest version **5.0.0** (published 2026-10-08) · MIT license · 0 weekly downloads

## Install

```sh
npm install markdown-it-table
pnpm add markdown-it-table
yarn add markdown-it-table
bun add markdown-it-table
```

## Health

**Score 75/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; has provenance; recently updated; high maintenance score; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 5.0.0 |
| Published | 2026-10-08 |
| First published | 2017-07-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >12.6 |
| Dependencies | 0 |
| Unpacked size | 20.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 19 |
| Author | Rifat Nabi |
| Maintainers | 1999, rifat |
| Keywords | markdown, markdown-it, markdown-it-plugin, table |

## Links

- npm: https://www.npmjs.com/package/markdown-it-table
- Repository: https://github.com/torifat/markdown-it-table
- Homepage: https://github.com/torifat/markdown-it-table#readme
- Issues: https://github.com/torifat/markdown-it-table/issues
- npm.io page: https://npm.io/package/markdown-it-table

## Alternatives

- [@lexical/table](https://npm.io/package/@lexical/table.md) — 3.0M weekly downloads
- [mantine-datatable](https://npm.io/package/mantine-datatable.md) — 98.2K weekly downloads
- [react-native-collapsible-tab-view](https://npm.io/package/react-native-collapsible-tab-view.md) — 70.6K weekly downloads
- [@handsontable/vue3](https://npm.io/package/@handsontable/vue3.md) — 16.1K weekly downloads
- [vuewordcloud](https://npm.io/package/vuewordcloud.md) — 7.2K weekly downloads

## Recent versions

- 5.0.0 (latest) — 2026-10-08
- 4.2.0 — 2026-10-08
- 4.1.3 — 2026-10-08
- 4.1.2 — 2026-10-08
- 4.1.1 — 2023-08-17
- 4.1.0 — 2023-07-11
- 4.0.0 — 2023-07-09
- 2.0.6 — 2023-07-07
- 2.0.4 — 2018-08-01
- 2.0.3 — 2018-05-15
- 2.0.2 — 2018-03-04
- 2.0.1 — 2018-03-04
- 2.0.0 — 2018-02-22
- 1.0.4 — 2018-01-30
- 1.0.3 — 2017-11-27
- … 5 more at https://npm.io/package/markdown-it-table/versions

## README

# markdown-it-table

[![CI](https://github.com/torifat/markdown-it-table/actions/workflows/ci.yml/badge.svg)](https://github.com/torifat/markdown-it-table/actions/workflows/ci.yml) [![NPM version](https://img.shields.io/npm/v/markdown-it-table.svg?style=flat)](https://www.npmjs.org/package/markdown-it-table)

> Plugin for [markdown-it](https://github.com/markdown-it/markdown-it) markdown parser, adding table with nested block syntax support.

> [!WARNING]
> These tables are neither CommonMark nor GFM. CommonMark has no table syntax, and GFM cells hold inline content only, so GitHub renders `| - item |` as the text `- item` where this plugin renders a list. The HTML differs as well, as listed under [Differences from markdown-it's table](#differences-from-markdown-its-table).

## Install

```bash
$ yarn add markdown-it-table
```

## Usage

markdown-it's default preset has its own `table` rule, and that rule runs before this plugin. Disable it, or start from the `commonmark` preset, which leaves it off.

```js
import MarkdownIt from "markdown-it";
import { markdownItTable } from "markdown-it-table";

const md = new MarkdownIt().disable("table").use(markdownItTable);
```

With the `commonmark` preset, `new MarkdownIt("commonmark").use(markdownItTable)` is enough. That preset also sets `html: true`, so raw HTML in the source reaches the output. For untrusted input, pass `{ html: false }` with it or use the default preset. CommonJS works with `const { markdownItTable } = require("markdown-it-table");`. The plugin takes no options.

## Syntax

A table is a header row, a delimiter row, then one line per body row. In the delimiter row, `:--` aligns a column left, `:-:` centers it and `--:` aligns it right. A line without a `|` ends the table, and so does a line that starts another block, such as a blockquote, list, heading, fence or HTML block.

The plugin parses each body cell as markdown blocks, so a cell can hold a list, a blockquote, a heading or a thematic break.

```md
| Syntax | Cell          |
| ------ | ------------- |
| List   | - item        |
| Quote  | > quoted text |
```

renders as

<table>
<tr>
<th>
<p>Syntax</p>
</th>
<th>
<p>Cell</p>
</th>
</tr>
<tr>
<td>
<p>List</p>
</td>
<td>
<ul>
<li>item</li>
</ul>
</td>
</tr>
<tr>
<td>
<p>Quote</p>
</td>
<td>
<blockquote>
<p>quoted text</p>
</blockquote>
</td>
</tr>
</table>

<details>
<summary>HTML</summary>

```html
<table>
<tr>
<th>
<p>Syntax</p>
</th>
<th>
<p>Cell</p>
</th>
</tr>
<tr>
<td>
<p>List</p>
</td>
<td>
<ul>
<li>item</li>
</ul>
</td>
</tr>
<tr>
<td>
<p>Quote</p>
</td>
<td>
<blockquote>
<p>quoted text</p>
</blockquote>
</td>
</tr>
</table>
```

</details>

### Cells

- Header cells take inline markdown only.
- A row is one line, so a cell's content has to fit on it.
- The plugin ignores the spaces and tabs around a cell's content, so a padded cell never turns into an indented code block.
- A cell holding only a list marker, like `| - |` or `| 1. |`, renders as that text.
- `\|` and a `|` inside a code span don't split a cell.

## Differences from markdown-it's table

- Plain text in a cell goes in a `<p>`, header cells included.
- There is no `<thead>` or `<tbody>`. Rows go straight into `<table>`.
- Rows keep the cells they're written with. markdown-it pads short rows and drops extra cells to match the header.
- A `|` inside a code span stays in the cell. markdown-it splits the cell there.

---
_Source: https://npm.io/package/markdown-it-table · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
