From 75fe6e0c76ed3f65948778a09d63d032a86d2da7 Mon Sep 17 00:00:00 2001 From: Alex Kocharin Date: Mon, 19 Oct 2020 14:10:28 +0300 Subject: [PATCH] Fix tables inside lists indented with tabs close https://github.com/markdown-it/markdown-it/issues/721 --- CHANGELOG.md | 6 +++++ lib/rules_block/table.js | 2 +- test/fixtures/markdown-it/tables.txt | 36 ++++++++++++++++++++++++++++ 3 files changed, 43 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b49fa0db4..030c46dfa 100644 --- a/CHANGELOG.md +++ b/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 diff --git a/lib/rules_block/table.js b/lib/rules_block/table.js index 44895fe12..4b1774270 100644 --- a/lib/rules_block/table.js +++ b/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); diff --git a/test/fixtures/markdown-it/tables.txt b/test/fixtures/markdown-it/tables.txt index 2ddf36772..c8e0d7805 100644 --- a/test/fixtures/markdown-it/tables.txt +++ b/test/fixtures/markdown-it/tables.txt @@ -568,6 +568,42 @@ Escape before escaped Pipes inside backticks don't split cells: . +Regression test for #721, table in a list indented with tabs: +. +- Level 1 + + - Level 2 + + | Column 1 | Column 2 | + | -------- | -------- | + | abcdefgh | ijklmnop | +. + +. + GFM 4.10 Tables (extension), Example 198 . | foo | bar |