Repository navigation
Body cells now parse block syntax even when they're padded. This changes output for existing tables, so it's a major release.
Breaking changes
Padded cells parse block syntax. In 4.x, block syntax only worked in a cell with no space after the |. Now the spaces and tabs around a cell's content are ignored.
| Cell | 4.2.0 | 5.0.0 |
|---|---|---|
| - item | |
<p>- item</p> |
<ul><li>item</li></ul> |
| 2. item | |
<p>2. item</p> |
<ol start="2"><li>item</li></ol> |
| ## Heading | |
<p>## Heading</p> |
<h2>Heading</h2> |
| --- | |
<p>---</p> |
<hr> |
HTML blocks and reference definitions follow the same rule. With html: true, | <div>x</div> | renders the <div> without a <p> around it. | [r]: /x | defines r for the whole document, as it would in a blockquote. Blockquotes in padded cells already worked. A cell padded by four or more spaces is still a paragraph, not an indented code block.
A cell holding only a list marker renders the marker. |-|, |*| and |1.| used to render empty, and |+| and |1)| rendered an empty list. They all render the marker as text now, as | - | already did and as markdown-it's own table does.
Upgrading
To start a cell with a literal marker, escape it:
| \- item | \## Heading | 2\. item | \--- |Check tables with padded cells that start with -, *, +, #, a number followed by . or ), a ***, --- or ___ rule, or [label]:. With html: true, also check cells that start with HTML.
Docs
The README now covers setup, the table syntax, how cells are parsed, and how the output differs from markdown-it's table (#11).
It also fixes the setup example. markdown-it's default preset has its own table rule, and that rule runs before this plugin. Call .disable("table") before .use(markdownItTable), or start from the commonmark preset. The old example did neither, so tables never reached the plugin.
Full Changelog: v4.2.0...v5.0.0