diff --git a/README.md b/README.md index 63810e66..067dfa9d 100644 --- a/README.md +++ b/README.md @@ -135,6 +135,7 @@ playground for learning and exploring. - **[MD053](doc/md053.md)** *link-image-reference-definitions* - Link and image reference definitions should be needed - **[MD054](doc/md054.md)** *link-image-style* - Link and image style - **[MD055](doc/md055.md)** *table-pipe-style* - Table pipe style +- **[MD056](doc/md056.md)** *table-column-count* - Table column count @@ -176,7 +177,7 @@ rules at once. - **`ol`** - `MD029`, `MD030`, `MD032` - **`spaces`** - `MD018`, `MD019`, `MD020`, `MD021`, `MD023` - **`spelling`** - `MD044` -- **`table`** - `MD055` +- **`table`** - `MD055`, `MD056` - **`ul`** - `MD004`, `MD005`, `MD007`, `MD030`, `MD032` - **`url`** - `MD034` - **`whitespace`** - `MD009`, `MD010`, `MD012`, `MD027`, `MD028`, `MD030`, diff --git a/demo/markdownlint-browser.js b/demo/markdownlint-browser.js index 1ea0183a..17bfa84d 100644 --- a/demo/markdownlint-browser.js +++ b/demo/markdownlint-browser.js @@ -6822,6 +6822,75 @@ module.exports = { /***/ }), +/***/ "../lib/md056.js": +/*!***********************!*\ + !*** ../lib/md056.js ***! + \***********************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; +// @ts-check + + + +function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; } +function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } +function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } +var _require = __webpack_require__(/*! ../helpers */ "../helpers/helpers.js"), + addErrorDetailIf = _require.addErrorDetailIf; +var _require2 = __webpack_require__(/*! ../helpers/micromark.cjs */ "../helpers/micromark.cjs"), + filterByTypes = _require2.filterByTypes; +var makeRange = function makeRange(start, end) { + return [start, end - start + 1]; +}; +module.exports = { + "names": ["MD056", "table-column-count"], + "description": "Table column count", + "tags": ["table"], + "function": function MD056(params, onError) { + var tables = filterByTypes(params.parsers.micromark.tokens, ["table"]); + var _iterator = _createForOfIteratorHelper(tables), + _step; + try { + for (_iterator.s(); !(_step = _iterator.n()).done;) { + var table = _step.value; + var rows = filterByTypes(table.children, ["tableDelimiterRow", "tableRow"]); + var expectedCount = 0; + var _iterator2 = _createForOfIteratorHelper(rows), + _step2; + try { + for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) { + var row = _step2.value; + var cells = filterByTypes(row.children, ["tableData", "tableDelimiter", "tableHeader"]); + var actualCount = cells.length; + expectedCount || (expectedCount = actualCount); + var detail = null; + var range = null; + if (actualCount < expectedCount) { + detail = "Too few cells, row will be missing data"; + range = [row.endColumn - 1, 1]; + } else if (expectedCount < actualCount) { + detail = "Too many cells, extra data will be missing"; + range = makeRange(cells[expectedCount].startColumn, row.endColumn - 1); + } + addErrorDetailIf(onError, row.endLine, expectedCount, actualCount, detail, null, range); + } + } catch (err) { + _iterator2.e(err); + } finally { + _iterator2.f(); + } + } + } catch (err) { + _iterator.e(err); + } finally { + _iterator.f(); + } + } +}; + +/***/ }), + /***/ "../lib/rules.js": /*!***********************!*\ !*** ../lib/rules.js ***! @@ -6843,8 +6912,11 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len var _require = __webpack_require__(/*! ./constants */ "../lib/constants.js"), homepage = _require.homepage, version = _require.version; -var rules = [__webpack_require__(/*! ./md001 */ "../lib/md001.js"), __webpack_require__(/*! ./md003 */ "../lib/md003.js"), __webpack_require__(/*! ./md004 */ "../lib/md004.js"), __webpack_require__(/*! ./md005 */ "../lib/md005.js"), __webpack_require__(/*! ./md007 */ "../lib/md007.js"), __webpack_require__(/*! ./md009 */ "../lib/md009.js"), __webpack_require__(/*! ./md010 */ "../lib/md010.js"), __webpack_require__(/*! ./md011 */ "../lib/md011.js"), __webpack_require__(/*! ./md012 */ "../lib/md012.js"), __webpack_require__(/*! ./md013 */ "../lib/md013.js"), __webpack_require__(/*! ./md014 */ "../lib/md014.js"), __webpack_require__(/*! ./md018 */ "../lib/md018.js"), __webpack_require__(/*! ./md019 */ "../lib/md019.js"), __webpack_require__(/*! ./md020 */ "../lib/md020.js"), __webpack_require__(/*! ./md021 */ "../lib/md021.js"), __webpack_require__(/*! ./md022 */ "../lib/md022.js"), __webpack_require__(/*! ./md023 */ "../lib/md023.js"), __webpack_require__(/*! ./md024 */ "../lib/md024.js"), __webpack_require__(/*! ./md025 */ "../lib/md025.js"), __webpack_require__(/*! ./md026 */ "../lib/md026.js"), __webpack_require__(/*! ./md027 */ "../lib/md027.js"), __webpack_require__(/*! ./md028 */ "../lib/md028.js"), __webpack_require__(/*! ./md029 */ "../lib/md029.js"), __webpack_require__(/*! ./md030 */ "../lib/md030.js"), __webpack_require__(/*! ./md031 */ "../lib/md031.js"), __webpack_require__(/*! ./md032 */ "../lib/md032.js"), __webpack_require__(/*! ./md033 */ "../lib/md033.js"), __webpack_require__(/*! ./md034 */ "../lib/md034.js"), __webpack_require__(/*! ./md035 */ "../lib/md035.js"), __webpack_require__(/*! ./md036 */ "../lib/md036.js"), __webpack_require__(/*! ./md037 */ "../lib/md037.js"), __webpack_require__(/*! ./md038 */ "../lib/md038.js"), __webpack_require__(/*! ./md039 */ "../lib/md039.js"), __webpack_require__(/*! ./md040 */ "../lib/md040.js"), __webpack_require__(/*! ./md041 */ "../lib/md041.js"), __webpack_require__(/*! ./md042 */ "../lib/md042.js"), __webpack_require__(/*! ./md043 */ "../lib/md043.js"), __webpack_require__(/*! ./md044 */ "../lib/md044.js"), __webpack_require__(/*! ./md045 */ "../lib/md045.js"), __webpack_require__(/*! ./md046 */ "../lib/md046.js"), __webpack_require__(/*! ./md047 */ "../lib/md047.js"), __webpack_require__(/*! ./md048 */ "../lib/md048.js")].concat(_toConsumableArray(__webpack_require__(/*! ./md049-md050 */ "../lib/md049-md050.js")), [__webpack_require__(/*! ./md051 */ "../lib/md051.js"), __webpack_require__(/*! ./md052 */ "../lib/md052.js"), __webpack_require__(/*! ./md053 */ "../lib/md053.js"), __webpack_require__(/*! ./md054 */ "../lib/md054.js"), __webpack_require__(/*! ./md055 */ "../lib/md055.js") -// md056: See https://github.com/markdownlint/markdownlint +var rules = [__webpack_require__(/*! ./md001 */ "../lib/md001.js"), +// md002: Deprecated and removed +__webpack_require__(/*! ./md003 */ "../lib/md003.js"), __webpack_require__(/*! ./md004 */ "../lib/md004.js"), __webpack_require__(/*! ./md005 */ "../lib/md005.js"), +// md006: Deprecated and removed +__webpack_require__(/*! ./md007 */ "../lib/md007.js"), __webpack_require__(/*! ./md009 */ "../lib/md009.js"), __webpack_require__(/*! ./md010 */ "../lib/md010.js"), __webpack_require__(/*! ./md011 */ "../lib/md011.js"), __webpack_require__(/*! ./md012 */ "../lib/md012.js"), __webpack_require__(/*! ./md013 */ "../lib/md013.js"), __webpack_require__(/*! ./md014 */ "../lib/md014.js"), __webpack_require__(/*! ./md018 */ "../lib/md018.js"), __webpack_require__(/*! ./md019 */ "../lib/md019.js"), __webpack_require__(/*! ./md020 */ "../lib/md020.js"), __webpack_require__(/*! ./md021 */ "../lib/md021.js"), __webpack_require__(/*! ./md022 */ "../lib/md022.js"), __webpack_require__(/*! ./md023 */ "../lib/md023.js"), __webpack_require__(/*! ./md024 */ "../lib/md024.js"), __webpack_require__(/*! ./md025 */ "../lib/md025.js"), __webpack_require__(/*! ./md026 */ "../lib/md026.js"), __webpack_require__(/*! ./md027 */ "../lib/md027.js"), __webpack_require__(/*! ./md028 */ "../lib/md028.js"), __webpack_require__(/*! ./md029 */ "../lib/md029.js"), __webpack_require__(/*! ./md030 */ "../lib/md030.js"), __webpack_require__(/*! ./md031 */ "../lib/md031.js"), __webpack_require__(/*! ./md032 */ "../lib/md032.js"), __webpack_require__(/*! ./md033 */ "../lib/md033.js"), __webpack_require__(/*! ./md034 */ "../lib/md034.js"), __webpack_require__(/*! ./md035 */ "../lib/md035.js"), __webpack_require__(/*! ./md036 */ "../lib/md036.js"), __webpack_require__(/*! ./md037 */ "../lib/md037.js"), __webpack_require__(/*! ./md038 */ "../lib/md038.js"), __webpack_require__(/*! ./md039 */ "../lib/md039.js"), __webpack_require__(/*! ./md040 */ "../lib/md040.js"), __webpack_require__(/*! ./md041 */ "../lib/md041.js"), __webpack_require__(/*! ./md042 */ "../lib/md042.js"), __webpack_require__(/*! ./md043 */ "../lib/md043.js"), __webpack_require__(/*! ./md044 */ "../lib/md044.js"), __webpack_require__(/*! ./md045 */ "../lib/md045.js"), __webpack_require__(/*! ./md046 */ "../lib/md046.js"), __webpack_require__(/*! ./md047 */ "../lib/md047.js"), __webpack_require__(/*! ./md048 */ "../lib/md048.js")].concat(_toConsumableArray(__webpack_require__(/*! ./md049-md050 */ "../lib/md049-md050.js")), [__webpack_require__(/*! ./md051 */ "../lib/md051.js"), __webpack_require__(/*! ./md052 */ "../lib/md052.js"), __webpack_require__(/*! ./md053 */ "../lib/md053.js"), __webpack_require__(/*! ./md054 */ "../lib/md054.js"), __webpack_require__(/*! ./md055 */ "../lib/md055.js"), __webpack_require__(/*! ./md056 */ "../lib/md056.js") // md057: See https://github.com/markdownlint/markdownlint ]); var _iterator = _createForOfIteratorHelper(rules), diff --git a/doc-build/md055.md b/doc-build/md055.md index c4331707..9b4487a2 100644 --- a/doc-build/md055.md +++ b/doc-build/md055.md @@ -1,5 +1,5 @@ -This rule is triggered when a [GitHub Flavored Markdown table][gfm-table] is -inconsistent about its use of leading and trailing pipe characters (`|`). +This rule is triggered when a [GitHub Flavored Markdown table][gfm-table-055] +is inconsistent about its use of leading and trailing pipe characters (`|`). By default (`consistent` style), the header row of the first table in a document is used to determine the style that is enforced for all tables in that document. @@ -10,18 +10,18 @@ missing the trailing pipe and its first row of cells is missing the leading pipe: ```markdown -| Heading | Heading | -| ------- | ------- - Cell | Cell | +| Header | Header | +| ------ | ------ + Cell | Cell | ``` To fix these issues, make sure there is a pipe character at the beginning and end of every row: ```markdown -| Heading | Heading | -| ------- | ------- | -| Cell | Cell | +| Header | Header | +| ------ | ------ | +| Cell | Cell | ``` Note that text immediately following a table (i.e., not separated by an empty @@ -29,9 +29,9 @@ line) is treated as part of the table (per the specification) and may also trigger this rule: ```markdown -| Heading | Heading | -| ------- | ------- | -| Cell | Cell | +| Header | Header | +| ------ | ------ | +| Cell | Cell | This text is part of the table ``` @@ -39,4 +39,4 @@ Rationale: Some parsers have difficulty with tables that are missing their leading or trailing pipe characters. The use of leading/trailing pipes can also help provide visual clarity. -[gfm-table]: https://github.github.com/gfm/#tables-extension- +[gfm-table-055]: https://github.github.com/gfm/#tables-extension- diff --git a/doc-build/md056.md b/doc-build/md056.md new file mode 100644 index 00000000..b885d59f --- /dev/null +++ b/doc-build/md056.md @@ -0,0 +1,31 @@ +This rule is triggered when a [GitHub Flavored Markdown table][gfm-table-056] +does not have the same number of cells in every row. + +This table's second data row has too few cells and its third data row has too +many cells: + +```markdown +| Header | Header | +| ------ | ------ | +| Cell | Cell | +| Cell | +| Cell | Cell | Cell | +``` + +To fix these issues, ensure every row has the same number of cells: + +```markdown +| Header | Header | +| ------ | ------ | +| Cell | Cell | +| Cell | Cell | +| Cell | Cell | +``` + +Note that a table's header row and its delimiter row must have the same number +of cells or it will not be recognized as a table (per specification). + +Rationale: Extra cells in a row are usually not shown, so their data is lost. +Missing cells in a row create holes in the table and suggest an omission. + +[gfm-table-056]: https://github.github.com/gfm/#tables-extension- diff --git a/doc/Rules.md b/doc/Rules.md index 32c86291..ddeeebd1 100644 --- a/doc/Rules.md +++ b/doc/Rules.md @@ -2337,8 +2337,8 @@ Parameters: `consistent` / `leading_and_trailing` / `leading_only` / `no_leading_or_trailing` / `trailing_only`) -This rule is triggered when a [GitHub Flavored Markdown table][gfm-table] is -inconsistent about its use of leading and trailing pipe characters (`|`). +This rule is triggered when a [GitHub Flavored Markdown table][gfm-table-055] +is inconsistent about its use of leading and trailing pipe characters (`|`). By default (`consistent` style), the header row of the first table in a document is used to determine the style that is enforced for all tables in that document. @@ -2349,18 +2349,18 @@ missing the trailing pipe and its first row of cells is missing the leading pipe: ```markdown -| Heading | Heading | -| ------- | ------- - Cell | Cell | +| Header | Header | +| ------ | ------ + Cell | Cell | ``` To fix these issues, make sure there is a pipe character at the beginning and end of every row: ```markdown -| Heading | Heading | -| ------- | ------- | -| Cell | Cell | +| Header | Header | +| ------ | ------ | +| Cell | Cell | ``` Note that text immediately following a table (i.e., not separated by an empty @@ -2368,9 +2368,9 @@ line) is treated as part of the table (per the specification) and may also trigger this rule: ```markdown -| Heading | Heading | -| ------- | ------- | -| Cell | Cell | +| Header | Header | +| ------ | ------ | +| Cell | Cell | This text is part of the table ``` @@ -2378,7 +2378,47 @@ Rationale: Some parsers have difficulty with tables that are missing their leading or trailing pipe characters. The use of leading/trailing pipes can also help provide visual clarity. -[gfm-table]: https://github.github.com/gfm/#tables-extension- +[gfm-table-055]: https://github.github.com/gfm/#tables-extension- + + + +## `MD056` - Table column count + +Tags: `table` + +Aliases: `table-column-count` + +This rule is triggered when a [GitHub Flavored Markdown table][gfm-table-056] +does not have the same number of cells in every row. + +This table's second data row has too few cells and its third data row has too +many cells: + +```markdown +| Header | Header | +| ------ | ------ | +| Cell | Cell | +| Cell | +| Cell | Cell | Cell | +``` + +To fix these issues, ensure every row has the same number of cells: + +```markdown +| Header | Header | +| ------ | ------ | +| Cell | Cell | +| Cell | Cell | +| Cell | Cell | +``` + +Note that a table's header row and its delimiter row must have the same number +of cells or it will not be recognized as a table (per specification). + +Rationale: Extra cells in a row are usually not shown, so their data is lost. +Missing cells in a row create holes in the table and suggest an omission. + +[gfm-table-056]: https://github.github.com/gfm/#tables-extension- ␊ ␊ - ## Missing in Heading Row␊ + ## Missing in Header Row␊ ␊ | Table | {MD055}␊ |-------|---------|␊ @@ -53805,111 +54771,111 @@ Generated by [AVA](https://avajs.dev). ␊ ## Missing in Separator Row␊ ␊ - | Table | Heading |␊ - |-------|---------␊ + | Table | Header |␊ + |-------|--------␊ ␊ {MD055:-2}␊ ␊ - | Table | Heading |␊ - -------|---------|␊ + | Table | Header |␊ + -------|--------|␊ ␊ {MD055:-2}␊ ␊ - | Table | Heading |␊ - -------|---------␊ + | Table | Header |␊ + -------|--------␊ ␊ {MD055:-2}␊ ␊ ## Missing Leading and Trailing␊ ␊ - {MD055} | Heading␊ - ---------|---------␊ + {MD055} | Header␊ + ---------|--------␊ {MD055} | Cell␊ ␊ {MD055:-3}␊ ␊ - {MD055} | Heading␊ - --------:|:-------:␊ + {MD055} | Header␊ + --------:|:------:␊ {MD055} | Cell␊ ␊ {MD055:-3}␊ ␊ - | Table | Heading |␊ - |--------:|:--------|␊ + | Table | Header |␊ + |--------:|:-------|␊ {MD055} | Cell␊ ␊ - | Table | Heading |␊ - |---------|---------|␊ + | Table | Header |␊ + |---------|--------|␊ {MD055} | Cell␊ - | Cell | Cell |␊ - | Cell | Cell |␊ + | Cell | Cell |␊ + | Cell | Cell |␊ ␊ - | Table | Heading |␊ - |---------|---------|␊ - | Cell | Cell |␊ + | Table | Header |␊ + |---------|--------|␊ + | Cell | Cell |␊ {MD055} | Cell␊ - | Cell | Cell |␊ + | Cell | Cell |␊ ␊ - | Table | Heading |␊ - |---------|---------|␊ - | Cell | Cell |␊ - | Cell | Cell |␊ + | Table | Header |␊ + |---------|--------|␊ + | Cell | Cell |␊ + | Cell | Cell |␊ {MD055} | Cell␊ ␊ ## Missing Trailing␊ ␊ - | Table | Heading |␊ - |--------:|:--------|␊ + | Table | Header |␊ + |--------:|:-------|␊ | {MD055} | Cell␊ ␊ - | Table | Heading |␊ - |---------|---------|␊ + | Table | Header |␊ + |---------|--------|␊ | {MD055} | Cell␊ - | Cell | Cell |␊ - | Cell | Cell |␊ + | Cell | Cell |␊ + | Cell | Cell |␊ ␊ - | Table | Heading |␊ - |---------|---------|␊ - | Cell | Cell |␊ + | Table | Header |␊ + |---------|--------|␊ + | Cell | Cell |␊ | {MD055} | Cell␊ - | Cell | Cell |␊ + | Cell | Cell |␊ ␊ - | Table | Heading |␊ - |---------|---------|␊ - | Cell | Cell |␊ - | Cell | Cell |␊ + | Table | Header |␊ + |---------|--------|␊ + | Cell | Cell |␊ + | Cell | Cell |␊ | {MD055} | Cell␊ ␊ ## Missing Leading␊ ␊ - | Table | Heading |␊ - |--------:|:--------|␊ - {MD055} | Cell |␊ + | Table | Header |␊ + |--------:|:-------|␊ + {MD055} | Cell |␊ ␊ - | Table | Heading |␊ - |---------|---------|␊ - {MD055} | Cell |␊ - | Cell | Cell |␊ - | Cell | Cell |␊ + | Table | Header |␊ + |---------|--------|␊ + {MD055} | Cell |␊ + | Cell | Cell |␊ + | Cell | Cell |␊ ␊ - | Table | Heading |␊ - |---------|---------|␊ - | Cell | Cell |␊ - {MD055} | Cell |␊ - | Cell | Cell |␊ + | Table | Header |␊ + |---------|--------|␊ + | Cell | Cell |␊ + {MD055} | Cell |␊ + | Cell | Cell |␊ ␊ - | Table | Heading |␊ - |---------|---------|␊ - | Cell | Cell |␊ - | Cell | Cell |␊ - {MD055} | Cell |␊ + | Table | Header |␊ + |---------|--------|␊ + | Cell | Cell |␊ + | Cell | Cell |␊ + {MD055} | Cell |␊ ␊ ## Followed by Text␊ ␊ - | Table | Heading |␊ - |-------|---------|␊ - | Cell | Cell |␊ - {MD055} Text␊ + | Table | Header |␊ + |-------|--------|␊ + | Cell | Cell |␊ + {MD055} {MD056} Text␊ ␊ ## Table inside Blockquote␊ ␊ @@ -53919,15 +54885,15 @@ Generated by [AVA](https://avajs.dev). ␊ ## Well-Formed␊ ␊ - | Table | Heading |␊ - |-------|---------|␊ - | Cell | Cell |␊ + | Table | Header |␊ + |-------|--------|␊ + | Cell | Cell |␊ ␊ - | Table | Heading |␊ - |-------|---------|␊ - | Cell | Cell |␊ - | Cell | Cell |␊ - | Cell | Cell |␊ + | Table | Header |␊ + |-------|--------|␊ + | Cell | Cell |␊ + | Cell | Cell |␊ + | Cell | Cell |␊ ␊ ## Leading and Trailing Spaces␊ ␊ diff --git a/test/snapshots/markdownlint-test-scenarios.js.snap b/test/snapshots/markdownlint-test-scenarios.js.snap index 595caa5f..51e3afcb 100644 Binary files a/test/snapshots/markdownlint-test-scenarios.js.snap and b/test/snapshots/markdownlint-test-scenarios.js.snap differ diff --git a/test/table-column-count.md b/test/table-column-count.md new file mode 100644 index 00000000..79cbb4a4 --- /dev/null +++ b/test/table-column-count.md @@ -0,0 +1,141 @@ +# Table Column Count + +## Expected + +| Table | +|-------| +| Cell | +| Cell | +| Cell | + +| Table | Header | +|-------|--------| +| Cell | Cell | +| Cell | Cell | +| Cell | Cell | + +| Table | Header | Header | +|-------|--------|--------| +| Cell | Cell | Cell | +| Cell | Cell | Cell | +| Cell | Cell | Cell | + + Table | Header +-------|-------- + Cell | Cell + +{MD055:-4} {MD055:-3} {MD055:-2} + + | Table | Header | + |-------|--------| + | Cell | Cell | + +{MD009:-4} {MD009:-3} {MD009:-2} + +## Blank + +| Table | +|-------| +| | +| Cell | + +| Table | Header | Header | +|-------|--------|--------| +| | Cell | Cell | +| Cell | | Cell | +| Cell | Cell | | +| | | | + +## Too Few + +| Table | Header | +|-------|--------| +| Cell | +| Cell | Cell | +| Cell | + +{MD056:-4} {MD056:-2} + +| Table | Header | Header | +|-------|--------|--------| +| Cell | +| Cell | Cell | +| Cell | Cell | Cell | + +{MD056:-4} {MD056:-3} + + Table | Header +-------|-------- + Cell + +{MD055:-4} {MD055:-3} {MD055:-2} {MD056:-2} + + | Table | Header | + |-------|--------| + | Cell | + +{MD009:-4} {MD009:-3} {MD009:-2} {MD056:-2} + +## Too Many + +| Table | +|-------| +| Cell | +| Cell | Cell | +| Cell | + +{MD056:-3} + +| Table | Header | +|-------|--------| +| Cell | Cell | Cell | Cell | +| Cell | Cell | Cell | +| Cell | Cell | + +{MD056:-4} {MD056:-3} + +| Table | Header | Header | +|-------|--------|--------| +| Cell | Cell | Cell | Cell | +| Cell | Cell | Cell | +| Cell | Cell | Cell | Cell | Cell | + +{MD056:-4} {MD056:-2} + + Table | Header +-------|-------- + Cell | Cell | Cell + +{MD055:-4} {MD055:-3} {MD055:-2} {MD056:-2} + + | Table | Header | + |-------|--------| + | Cell | Cell | Cell | + +{MD009:-4} {MD009:-3} {MD009:-2} {MD056:-2} + +## Mixed + +| Table | +|-------| +| Cell | Cell | +| Cell | +| Cell | Cell | + +{MD056:-4} {MD056:-2} + +| Table | Header | +|-------|--------| +| Cell | Cell | Cell | +| Cell | +| Cell | Cell | + +{MD056:-4} {MD056:-3} + +| Table | Header | Header | +|-------|--------|--------| +| Cell | Cell | Cell | +| Cell | Cell | Cell | Cell | +| Cell | + +{MD056:-3} {MD056:-2} diff --git a/test/table-pipe-style.md b/test/table-pipe-style.md index aba8bcce..e419549e 100644 --- a/test/table-pipe-style.md +++ b/test/table-pipe-style.md @@ -6,7 +6,7 @@ } } --> -## Missing in Heading Row +## Missing in Header Row | Table | {MD055} |-------|---------| @@ -19,111 +19,111 @@ ## Missing in Separator Row -| Table | Heading | -|-------|--------- +| Table | Header | +|-------|-------- {MD055:-2} -| Table | Heading | - -------|---------| +| Table | Header | + -------|--------| {MD055:-2} -| Table | Heading | - -------|--------- +| Table | Header | + -------|-------- {MD055:-2} ## Missing Leading and Trailing - {MD055} | Heading ----------|--------- + {MD055} | Header +---------|-------- {MD055} | Cell {MD055:-3} - {MD055} | Heading ---------:|:-------: + {MD055} | Header +--------:|:------: {MD055} | Cell {MD055:-3} -| Table | Heading | -|--------:|:--------| +| Table | Header | +|--------:|:-------| {MD055} | Cell -| Table | Heading | -|---------|---------| +| Table | Header | +|---------|--------| {MD055} | Cell -| Cell | Cell | -| Cell | Cell | +| Cell | Cell | +| Cell | Cell | -| Table | Heading | -|---------|---------| -| Cell | Cell | +| Table | Header | +|---------|--------| +| Cell | Cell | {MD055} | Cell -| Cell | Cell | +| Cell | Cell | -| Table | Heading | -|---------|---------| -| Cell | Cell | -| Cell | Cell | +| Table | Header | +|---------|--------| +| Cell | Cell | +| Cell | Cell | {MD055} | Cell ## Missing Trailing -| Table | Heading | -|--------:|:--------| +| Table | Header | +|--------:|:-------| | {MD055} | Cell -| Table | Heading | -|---------|---------| +| Table | Header | +|---------|--------| | {MD055} | Cell -| Cell | Cell | -| Cell | Cell | +| Cell | Cell | +| Cell | Cell | -| Table | Heading | -|---------|---------| -| Cell | Cell | +| Table | Header | +|---------|--------| +| Cell | Cell | | {MD055} | Cell -| Cell | Cell | +| Cell | Cell | -| Table | Heading | -|---------|---------| -| Cell | Cell | -| Cell | Cell | +| Table | Header | +|---------|--------| +| Cell | Cell | +| Cell | Cell | | {MD055} | Cell ## Missing Leading -| Table | Heading | -|--------:|:--------| - {MD055} | Cell | +| Table | Header | +|--------:|:-------| + {MD055} | Cell | -| Table | Heading | -|---------|---------| - {MD055} | Cell | -| Cell | Cell | -| Cell | Cell | +| Table | Header | +|---------|--------| + {MD055} | Cell | +| Cell | Cell | +| Cell | Cell | -| Table | Heading | -|---------|---------| -| Cell | Cell | - {MD055} | Cell | -| Cell | Cell | +| Table | Header | +|---------|--------| +| Cell | Cell | + {MD055} | Cell | +| Cell | Cell | -| Table | Heading | -|---------|---------| -| Cell | Cell | -| Cell | Cell | - {MD055} | Cell | +| Table | Header | +|---------|--------| +| Cell | Cell | +| Cell | Cell | + {MD055} | Cell | ## Followed by Text -| Table | Heading | -|-------|---------| -| Cell | Cell | -{MD055} Text +| Table | Header | +|-------|--------| +| Cell | Cell | +{MD055} {MD056} Text ## Table inside Blockquote @@ -133,15 +133,15 @@ ## Well-Formed -| Table | Heading | -|-------|---------| -| Cell | Cell | +| Table | Header | +|-------|--------| +| Cell | Cell | -| Table | Heading | -|-------|---------| -| Cell | Cell | -| Cell | Cell | -| Cell | Cell | +| Table | Header | +|-------|--------| +| Cell | Cell | +| Cell | Cell | +| Cell | Cell | ## Leading and Trailing Spaces