Browse Source

Table with no columns is no longer a table

this is now just raw text:

```md
|
|
|
```

close https://github.com/markdown-it/markdown-it/issues/724
pull/731/head
Alex Kocharin 4 years ago
parent
commit
b56eeb01d9
  1. 6
      CHANGELOG.md
  2. 2
      lib/rules_block/table.js
  3. 13
      test/fixtures/markdown-it/tables.txt

6
CHANGELOG.md

@ -6,6 +6,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [12.0.2] - WIP
### Fixed
- Three pipes (`|\n|\n|`) are no longer rendered as a table with no columns, #724.
## [12.0.1] - 2020-10-19
### Fixed
- Fix tables inside lists indented with tabs, #721.
@ -529,6 +534,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Renamed presets folder (configs -> presets).
[12.0.2]: https://github.com/markdown-it/markdown-it/compare/12.0.1...12.0.2
[12.0.1]: https://github.com/markdown-it/markdown-it/compare/12.0.0...12.0.1
[12.0.0]: https://github.com/markdown-it/markdown-it/compare/11.0.1...12.0.0
[11.0.1]: https://github.com/markdown-it/markdown-it/compare/11.0.0...11.0.1

2
lib/rules_block/table.js

@ -118,7 +118,7 @@ module.exports = function table(state, startLine, endLine, silent) {
// header row will define an amount of columns in the entire table,
// and align row should be exactly the same (the rest of the rows can differ)
columnCount = columns.length;
if (columnCount !== aligns.length) { return false; }
if (columnCount === 0 || columnCount !== aligns.length) { return false; }
if (silent) { return true; }

13
test/fixtures/markdown-it/tables.txt

@ -604,6 +604,19 @@ Regression test for #721, table in a list indented with tabs:
</ul>
.
Table without any columns is not a table, #724
.
|
|
|
.
<p>|
|
|</p>
.
GFM 4.10 Tables (extension), Example 198
.
| foo | bar |

Loading…
Cancel
Save