Browse Source

Fix tables inside lists indented with tabs

close https://github.com/markdown-it/markdown-it/issues/721
pull/722/head
Alex Kocharin 4 years ago
parent
commit
75fe6e0c76
  1. 6
      CHANGELOG.md
  2. 2
      lib/rules_block/table.js
  3. 36
      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.1] - WIP
### Fixed
- Fix tables inside lists indented with tabs, #721.
## [12.0.0] - 2020-10-14
### Added
- `.gitattributes`, force unix eol under windows, for development.
@ -524,6 +529,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Renamed presets folder (configs -> presets).
[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
[11.0.0]: https://github.com/markdown-it/markdown-it/compare/10.0.0...11.0.0

2
lib/rules_block/table.js

@ -6,7 +6,7 @@ var isSpace = require('../common/utils').isSpace;
function getLine(state, line) {
var pos = state.bMarks[line] + state.blkIndent,
var pos = state.bMarks[line] + state.tShift[line],
max = state.eMarks[line];
return state.src.substr(pos, max - pos);

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

@ -568,6 +568,42 @@ Escape before escaped Pipes inside backticks don't split cells:
</table>
.
Regression test for #721, table in a list indented with tabs:
.
- Level 1
- Level 2
| Column 1 | Column 2 |
| -------- | -------- |
| abcdefgh | ijklmnop |
.
<ul>
<li>
<p>Level 1</p>
<ul>
<li>
<p>Level 2</p>
<table>
<thead>
<tr>
<th>Column 1</th>
<th>Column 2</th>
</tr>
</thead>
<tbody>
<tr>
<td>abcdefgh</td>
<td>ijklmnop</td>
</tr>
</tbody>
</table>
</li>
</ul>
</li>
</ul>
.
GFM 4.10 Tables (extension), Example 198
.
| foo | bar |

Loading…
Cancel
Save