mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-16 05:50:13 +01:00
Add new rule MD058/blanks-around-tables (fixes #132).
This commit is contained in:
parent
5ecdb045a5
commit
26466108e9
27 changed files with 914 additions and 76 deletions
|
|
@ -136,6 +136,7 @@ playground for learning and exploring.
|
|||
- **[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
|
||||
- **[MD058](doc/md058.md)** *blanks-around-tables* - Tables should be surrounded by blank lines
|
||||
|
||||
<!-- markdownlint-restore -->
|
||||
|
||||
|
|
@ -177,7 +178,7 @@ rules at once.
|
|||
- **`ol`** - `MD029`, `MD030`, `MD032`
|
||||
- **`spaces`** - `MD018`, `MD019`, `MD020`, `MD021`, `MD023`
|
||||
- **`spelling`** - `MD044`
|
||||
- **`table`** - `MD055`, `MD056`
|
||||
- **`table`** - `MD055`, `MD056`, `MD058`
|
||||
- **`ul`** - `MD004`, `MD005`, `MD007`, `MD030`, `MD032`
|
||||
- **`url`** - `MD034`
|
||||
- **`whitespace`** - `MD009`, `MD010`, `MD012`, `MD027`, `MD028`, `MD030`,
|
||||
|
|
|
|||
|
|
@ -607,8 +607,20 @@ function addError(onError, lineNumber, detail, context, range, fixInfo) {
|
|||
}
|
||||
module.exports.addError = addError;
|
||||
|
||||
// Adds an error object with details conditionally via the onError callback
|
||||
module.exports.addErrorDetailIf = function addErrorDetailIf(
|
||||
/**
|
||||
* Adds an error object with details conditionally via the onError callback.
|
||||
*
|
||||
* @param {Object} onError RuleOnError instance.
|
||||
* @param {number} lineNumber Line number.
|
||||
* @param {Object} expected Expected value.
|
||||
* @param {Object} actual Actual value.
|
||||
* @param {string} [detail] Error details.
|
||||
* @param {string} [context] Error context.
|
||||
* @param {number[]} [range] Column and length of error.
|
||||
* @param {Object} [fixInfo] RuleOnErrorFixInfo instance.
|
||||
* @returns {void}
|
||||
*/
|
||||
function addErrorDetailIf(
|
||||
onError, lineNumber, expected, actual, detail, context, range, fixInfo) {
|
||||
if (expected !== actual) {
|
||||
addError(
|
||||
|
|
@ -620,14 +632,55 @@ module.exports.addErrorDetailIf = function addErrorDetailIf(
|
|||
range,
|
||||
fixInfo);
|
||||
}
|
||||
};
|
||||
}
|
||||
module.exports.addErrorDetailIf = addErrorDetailIf;
|
||||
|
||||
// Adds an error object with context via the onError callback
|
||||
module.exports.addErrorContext = function addErrorContext(
|
||||
onError, lineNumber, context, left, right, range, fixInfo) {
|
||||
context = ellipsify(context, left, right);
|
||||
/**
|
||||
* Adds an error object with context via the onError callback.
|
||||
*
|
||||
* @param {Object} onError RuleOnError instance.
|
||||
* @param {number} lineNumber Line number.
|
||||
* @param {string} context Error context.
|
||||
* @param {boolean} [start] True iff the start of the text is important.
|
||||
* @param {boolean} [end] True iff the end of the text is important.
|
||||
* @param {number[]} [range] Column and length of error.
|
||||
* @param {Object} [fixInfo] RuleOnErrorFixInfo instance.
|
||||
* @returns {void}
|
||||
*/
|
||||
function addErrorContext(
|
||||
onError, lineNumber, context, start, end, range, fixInfo) {
|
||||
context = ellipsify(context, start, end);
|
||||
addError(onError, lineNumber, undefined, context, range, fixInfo);
|
||||
};
|
||||
}
|
||||
module.exports.addErrorContext = addErrorContext;
|
||||
|
||||
/**
|
||||
* Adds an error object with context for a construct missing a blank line.
|
||||
*
|
||||
* @param {Object} onError RuleOnError instance.
|
||||
* @param {string[]} lines Lines of Markdown content.
|
||||
* @param {number} lineIndex Line index of line.
|
||||
* @param {number} [lineNumber] Line number for override.
|
||||
* @returns {void}
|
||||
*/
|
||||
function addErrorContextForLine(onError, lines, lineIndex, lineNumber) {
|
||||
const line = lines[lineIndex];
|
||||
// @ts-ignore
|
||||
const quotePrefix = line.match(blockquotePrefixRe)[0].trimEnd();
|
||||
addErrorContext(
|
||||
onError,
|
||||
lineIndex + 1,
|
||||
line.trim(),
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
{
|
||||
lineNumber,
|
||||
"insertText": `${quotePrefix}\n`
|
||||
}
|
||||
);
|
||||
}
|
||||
module.exports.addErrorContextForLine = addErrorContextForLine;
|
||||
|
||||
/**
|
||||
* Returns an array of code block and span content ranges.
|
||||
|
|
@ -1673,7 +1726,8 @@ module.exports.fixableRuleNames = [
|
|||
"MD012", "MD014", "MD018", "MD019", "MD020", "MD021",
|
||||
"MD022", "MD023", "MD026", "MD027", "MD030", "MD031",
|
||||
"MD032", "MD034", "MD037", "MD038", "MD039", "MD044",
|
||||
"MD047", "MD049", "MD050", "MD051", "MD053", "MD054"
|
||||
"MD047", "MD049", "MD050", "MD051", "MD053", "MD054",
|
||||
"MD058"
|
||||
];
|
||||
module.exports.homepage = "https://github.com/DavidAnson/markdownlint";
|
||||
module.exports.version = "0.34.0";
|
||||
|
|
@ -4058,6 +4112,7 @@ module.exports = {
|
|||
onError,
|
||||
// @ts-ignore
|
||||
i + 1,
|
||||
// @ts-ignore
|
||||
lineTrim,
|
||||
null,
|
||||
null,
|
||||
|
|
@ -4219,7 +4274,7 @@ module.exports = {
|
|||
const leftHashLength = leftHash.length;
|
||||
const rightHashLength = rightHash.length;
|
||||
const left = !leftSpaceLength;
|
||||
const right = !rightSpaceLength || rightEscape;
|
||||
const right = !rightSpaceLength || !!rightEscape;
|
||||
const rightEscapeReplacement = rightEscape ? `${rightEscape} ` : "";
|
||||
if (left || right) {
|
||||
const range = left ?
|
||||
|
|
@ -5011,28 +5066,12 @@ module.exports = {
|
|||
|
||||
|
||||
|
||||
const { addErrorContext, blockquotePrefixRe, isBlankLine } = __webpack_require__(/*! ../helpers */ "../helpers/helpers.js");
|
||||
const { addErrorContextForLine, isBlankLine } = __webpack_require__(/*! ../helpers */ "../helpers/helpers.js");
|
||||
const { filterByPredicate, nonContentTokens } = __webpack_require__(/*! ../helpers/micromark.cjs */ "../helpers/micromark.cjs");
|
||||
|
||||
const isList = (token) => (
|
||||
(token.type === "listOrdered") || (token.type === "listUnordered")
|
||||
);
|
||||
const addBlankLineError = (onError, lines, lineIndex, lineNumber) => {
|
||||
const line = lines[lineIndex];
|
||||
const quotePrefix = line.match(blockquotePrefixRe)[0].trimEnd();
|
||||
addErrorContext(
|
||||
onError,
|
||||
lineIndex + 1,
|
||||
line.trim(),
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
{
|
||||
lineNumber,
|
||||
"insertText": `${quotePrefix}\n`
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
// eslint-disable-next-line jsdoc/valid-types
|
||||
/** @type import("./markdownlint").Rule */
|
||||
|
|
@ -5062,7 +5101,12 @@ module.exports = {
|
|||
// Look for a blank line above the list
|
||||
const firstIndex = list.startLine - 1;
|
||||
if (!isBlankLine(lines[firstIndex - 1])) {
|
||||
addBlankLineError(onError, lines, firstIndex);
|
||||
addErrorContextForLine(
|
||||
onError,
|
||||
// @ts-ignore
|
||||
lines,
|
||||
firstIndex
|
||||
);
|
||||
}
|
||||
|
||||
// Find the "visual" end of the list
|
||||
|
|
@ -5078,7 +5122,13 @@ module.exports = {
|
|||
// Look for a blank line below the list
|
||||
const lastIndex = endLine - 1;
|
||||
if (!isBlankLine(lines[lastIndex + 1])) {
|
||||
addBlankLineError(onError, lines, lastIndex, lastIndex + 2);
|
||||
addErrorContextForLine(
|
||||
onError,
|
||||
// @ts-ignore
|
||||
lines,
|
||||
lastIndex,
|
||||
lastIndex + 2
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -6991,6 +7041,65 @@ module.exports = {
|
|||
}
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "../lib/md058.js":
|
||||
/*!***********************!*\
|
||||
!*** ../lib/md058.js ***!
|
||||
\***********************/
|
||||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||||
|
||||
"use strict";
|
||||
// @ts-check
|
||||
|
||||
|
||||
|
||||
const { addErrorContextForLine, isBlankLine } = __webpack_require__(/*! ../helpers */ "../helpers/helpers.js");
|
||||
const { filterByTypes } = __webpack_require__(/*! ../helpers/micromark.cjs */ "../helpers/micromark.cjs");
|
||||
|
||||
// eslint-disable-next-line jsdoc/valid-types
|
||||
/** @type import("./markdownlint").Rule */
|
||||
module.exports = {
|
||||
"names": [ "MD058", "blanks-around-tables" ],
|
||||
"description": "Tables should be surrounded by blank lines",
|
||||
"tags": [ "table" ],
|
||||
"parser": "micromark",
|
||||
"function": function MD058(params, onError) {
|
||||
// eslint-disable-next-line jsdoc/valid-types
|
||||
/** @type import("../helpers/micromark.cjs").Token[] */
|
||||
const micromarkTokens =
|
||||
// @ts-ignore
|
||||
params.parsers.micromark.tokens;
|
||||
const { lines } = params;
|
||||
// For every table...
|
||||
const tables = filterByTypes(micromarkTokens, [ "table" ]);
|
||||
for (const table of tables) {
|
||||
// Look for a blank line above the table
|
||||
const firstIndex = table.startLine - 1;
|
||||
if (!isBlankLine(lines[firstIndex - 1])) {
|
||||
addErrorContextForLine(
|
||||
onError,
|
||||
// @ts-ignore
|
||||
lines,
|
||||
firstIndex
|
||||
);
|
||||
}
|
||||
// Look for a blank line below the table
|
||||
const lastIndex = table.endLine - 1;
|
||||
if (!isBlankLine(lines[lastIndex + 1])) {
|
||||
addErrorContextForLine(
|
||||
onError,
|
||||
// @ts-ignore
|
||||
lines,
|
||||
lastIndex,
|
||||
lastIndex + 2
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "../lib/rules.js":
|
||||
|
|
@ -7057,8 +7166,9 @@ const rules = [
|
|||
__webpack_require__(/*! ./md053 */ "../lib/md053.js"),
|
||||
__webpack_require__(/*! ./md054 */ "../lib/md054.js"),
|
||||
__webpack_require__(/*! ./md055 */ "../lib/md055.js"),
|
||||
__webpack_require__(/*! ./md056 */ "../lib/md056.js")
|
||||
__webpack_require__(/*! ./md056 */ "../lib/md056.js"),
|
||||
// md057: See https://github.com/markdownlint/markdownlint
|
||||
__webpack_require__(/*! ./md058 */ "../lib/md058.js")
|
||||
];
|
||||
for (const rule of rules) {
|
||||
const name = rule.names[0].toLowerCase();
|
||||
|
|
|
|||
40
doc-build/md058.md
Normal file
40
doc-build/md058.md
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
This rule is triggered when tables are either not preceded or not followed by a
|
||||
blank line:
|
||||
|
||||
```markdown
|
||||
Some text
|
||||
| Header | Header |
|
||||
| ------ | ------ |
|
||||
| Cell | Cell |
|
||||
> Blockquote
|
||||
```
|
||||
|
||||
To fix violations of this rule, ensure that all tables have a blank line both
|
||||
before and after (except when the table is at the very beginning or end of the
|
||||
document):
|
||||
|
||||
```markdown
|
||||
Some text
|
||||
|
||||
| Header | Header |
|
||||
| ------ | ------ |
|
||||
| Cell | Cell |
|
||||
|
||||
> Blockquote
|
||||
```
|
||||
|
||||
Note that text immediately following a table (i.e., not separated by an empty
|
||||
line) is treated as part of the table (per the specification) and will not
|
||||
trigger this rule:
|
||||
|
||||
```markdown
|
||||
| Header | Header |
|
||||
| ------ | ------ |
|
||||
| Cell | Cell |
|
||||
This text is part of the table and the next line is blank
|
||||
|
||||
Some text
|
||||
```
|
||||
|
||||
Rationale: In addition to aesthetic reasons, some parsers will incorrectly parse
|
||||
tables that don't have blank lines before and after them.
|
||||
51
doc/Rules.md
51
doc/Rules.md
|
|
@ -2458,6 +2458,57 @@ Missing cells in a row create holes in the table and suggest an omission.
|
|||
|
||||
[gfm-table-056]: https://github.github.com/gfm/#tables-extension-
|
||||
|
||||
<a name="md058"></a>
|
||||
|
||||
## `MD058` - Tables should be surrounded by blank lines
|
||||
|
||||
Tags: `table`
|
||||
|
||||
Aliases: `blanks-around-tables`
|
||||
|
||||
Fixable: Some violations can be fixed by tooling
|
||||
|
||||
This rule is triggered when tables are either not preceded or not followed by a
|
||||
blank line:
|
||||
|
||||
```markdown
|
||||
Some text
|
||||
| Header | Header |
|
||||
| ------ | ------ |
|
||||
| Cell | Cell |
|
||||
> Blockquote
|
||||
```
|
||||
|
||||
To fix violations of this rule, ensure that all tables have a blank line both
|
||||
before and after (except when the table is at the very beginning or end of the
|
||||
document):
|
||||
|
||||
```markdown
|
||||
Some text
|
||||
|
||||
| Header | Header |
|
||||
| ------ | ------ |
|
||||
| Cell | Cell |
|
||||
|
||||
> Blockquote
|
||||
```
|
||||
|
||||
Note that text immediately following a table (i.e., not separated by an empty
|
||||
line) is treated as part of the table (per the specification) and will not
|
||||
trigger this rule:
|
||||
|
||||
```markdown
|
||||
| Header | Header |
|
||||
| ------ | ------ |
|
||||
| Cell | Cell |
|
||||
This text is part of the table and the next line is blank
|
||||
|
||||
Some text
|
||||
```
|
||||
|
||||
Rationale: In addition to aesthetic reasons, some parsers will incorrectly parse
|
||||
tables that don't have blank lines before and after them.
|
||||
|
||||
<!-- markdownlint-configure-file {
|
||||
"no-inline-html": {
|
||||
"allowed_elements": [
|
||||
|
|
|
|||
48
doc/md058.md
Normal file
48
doc/md058.md
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
# `MD058` - Tables should be surrounded by blank lines
|
||||
|
||||
Tags: `table`
|
||||
|
||||
Aliases: `blanks-around-tables`
|
||||
|
||||
Fixable: Some violations can be fixed by tooling
|
||||
|
||||
This rule is triggered when tables are either not preceded or not followed by a
|
||||
blank line:
|
||||
|
||||
```markdown
|
||||
Some text
|
||||
| Header | Header |
|
||||
| ------ | ------ |
|
||||
| Cell | Cell |
|
||||
> Blockquote
|
||||
```
|
||||
|
||||
To fix violations of this rule, ensure that all tables have a blank line both
|
||||
before and after (except when the table is at the very beginning or end of the
|
||||
document):
|
||||
|
||||
```markdown
|
||||
Some text
|
||||
|
||||
| Header | Header |
|
||||
| ------ | ------ |
|
||||
| Cell | Cell |
|
||||
|
||||
> Blockquote
|
||||
```
|
||||
|
||||
Note that text immediately following a table (i.e., not separated by an empty
|
||||
line) is treated as part of the table (per the specification) and will not
|
||||
trigger this rule:
|
||||
|
||||
```markdown
|
||||
| Header | Header |
|
||||
| ------ | ------ |
|
||||
| Cell | Cell |
|
||||
This text is part of the table and the next line is blank
|
||||
|
||||
Some text
|
||||
```
|
||||
|
||||
Rationale: In addition to aesthetic reasons, some parsers will incorrectly parse
|
||||
tables that don't have blank lines before and after them.
|
||||
|
|
@ -595,8 +595,20 @@ function addError(onError, lineNumber, detail, context, range, fixInfo) {
|
|||
}
|
||||
module.exports.addError = addError;
|
||||
|
||||
// Adds an error object with details conditionally via the onError callback
|
||||
module.exports.addErrorDetailIf = function addErrorDetailIf(
|
||||
/**
|
||||
* Adds an error object with details conditionally via the onError callback.
|
||||
*
|
||||
* @param {Object} onError RuleOnError instance.
|
||||
* @param {number} lineNumber Line number.
|
||||
* @param {Object} expected Expected value.
|
||||
* @param {Object} actual Actual value.
|
||||
* @param {string} [detail] Error details.
|
||||
* @param {string} [context] Error context.
|
||||
* @param {number[]} [range] Column and length of error.
|
||||
* @param {Object} [fixInfo] RuleOnErrorFixInfo instance.
|
||||
* @returns {void}
|
||||
*/
|
||||
function addErrorDetailIf(
|
||||
onError, lineNumber, expected, actual, detail, context, range, fixInfo) {
|
||||
if (expected !== actual) {
|
||||
addError(
|
||||
|
|
@ -608,14 +620,55 @@ module.exports.addErrorDetailIf = function addErrorDetailIf(
|
|||
range,
|
||||
fixInfo);
|
||||
}
|
||||
};
|
||||
}
|
||||
module.exports.addErrorDetailIf = addErrorDetailIf;
|
||||
|
||||
// Adds an error object with context via the onError callback
|
||||
module.exports.addErrorContext = function addErrorContext(
|
||||
onError, lineNumber, context, left, right, range, fixInfo) {
|
||||
context = ellipsify(context, left, right);
|
||||
/**
|
||||
* Adds an error object with context via the onError callback.
|
||||
*
|
||||
* @param {Object} onError RuleOnError instance.
|
||||
* @param {number} lineNumber Line number.
|
||||
* @param {string} context Error context.
|
||||
* @param {boolean} [start] True iff the start of the text is important.
|
||||
* @param {boolean} [end] True iff the end of the text is important.
|
||||
* @param {number[]} [range] Column and length of error.
|
||||
* @param {Object} [fixInfo] RuleOnErrorFixInfo instance.
|
||||
* @returns {void}
|
||||
*/
|
||||
function addErrorContext(
|
||||
onError, lineNumber, context, start, end, range, fixInfo) {
|
||||
context = ellipsify(context, start, end);
|
||||
addError(onError, lineNumber, undefined, context, range, fixInfo);
|
||||
};
|
||||
}
|
||||
module.exports.addErrorContext = addErrorContext;
|
||||
|
||||
/**
|
||||
* Adds an error object with context for a construct missing a blank line.
|
||||
*
|
||||
* @param {Object} onError RuleOnError instance.
|
||||
* @param {string[]} lines Lines of Markdown content.
|
||||
* @param {number} lineIndex Line index of line.
|
||||
* @param {number} [lineNumber] Line number for override.
|
||||
* @returns {void}
|
||||
*/
|
||||
function addErrorContextForLine(onError, lines, lineIndex, lineNumber) {
|
||||
const line = lines[lineIndex];
|
||||
// @ts-ignore
|
||||
const quotePrefix = line.match(blockquotePrefixRe)[0].trimEnd();
|
||||
addErrorContext(
|
||||
onError,
|
||||
lineIndex + 1,
|
||||
line.trim(),
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
{
|
||||
lineNumber,
|
||||
"insertText": `${quotePrefix}\n`
|
||||
}
|
||||
);
|
||||
}
|
||||
module.exports.addErrorContextForLine = addErrorContextForLine;
|
||||
|
||||
/**
|
||||
* Returns an array of code block and span content ranges.
|
||||
|
|
|
|||
10
lib/configuration.d.ts
vendored
10
lib/configuration.d.ts
vendored
|
|
@ -1078,6 +1078,14 @@ export interface Configuration {
|
|||
* MD056/table-column-count : Table column count : https://github.com/DavidAnson/markdownlint/blob/v0.34.0/doc/md056.md
|
||||
*/
|
||||
"table-column-count"?: boolean;
|
||||
/**
|
||||
* MD058/blanks-around-tables : Tables should be surrounded by blank lines : https://github.com/DavidAnson/markdownlint/blob/v0.34.0/doc/md058.md
|
||||
*/
|
||||
MD058?: boolean;
|
||||
/**
|
||||
* MD058/blanks-around-tables : Tables should be surrounded by blank lines : https://github.com/DavidAnson/markdownlint/blob/v0.34.0/doc/md058.md
|
||||
*/
|
||||
"blanks-around-tables"?: boolean;
|
||||
/**
|
||||
* headings : MD001, MD003, MD018, MD019, MD020, MD021, MD022, MD023, MD024, MD025, MD026, MD036, MD041, MD043
|
||||
*/
|
||||
|
|
@ -1171,7 +1179,7 @@ export interface Configuration {
|
|||
*/
|
||||
images?: boolean;
|
||||
/**
|
||||
* table : MD055, MD056
|
||||
* table : MD055, MD056, MD058
|
||||
*/
|
||||
table?: boolean;
|
||||
[k: string]: unknown;
|
||||
|
|
|
|||
|
|
@ -8,7 +8,8 @@ module.exports.fixableRuleNames = [
|
|||
"MD012", "MD014", "MD018", "MD019", "MD020", "MD021",
|
||||
"MD022", "MD023", "MD026", "MD027", "MD030", "MD031",
|
||||
"MD032", "MD034", "MD037", "MD038", "MD039", "MD044",
|
||||
"MD047", "MD049", "MD050", "MD051", "MD053", "MD054"
|
||||
"MD047", "MD049", "MD050", "MD051", "MD053", "MD054",
|
||||
"MD058"
|
||||
];
|
||||
module.exports.homepage = "https://github.com/DavidAnson/markdownlint";
|
||||
module.exports.version = "0.34.0";
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@ module.exports = {
|
|||
onError,
|
||||
// @ts-ignore
|
||||
i + 1,
|
||||
// @ts-ignore
|
||||
lineTrim,
|
||||
null,
|
||||
null,
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ module.exports = {
|
|||
const leftHashLength = leftHash.length;
|
||||
const rightHashLength = rightHash.length;
|
||||
const left = !leftSpaceLength;
|
||||
const right = !rightSpaceLength || rightEscape;
|
||||
const right = !rightSpaceLength || !!rightEscape;
|
||||
const rightEscapeReplacement = rightEscape ? `${rightEscape} ` : "";
|
||||
if (left || right) {
|
||||
const range = left ?
|
||||
|
|
|
|||
33
lib/md032.js
33
lib/md032.js
|
|
@ -2,28 +2,12 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
const { addErrorContext, blockquotePrefixRe, isBlankLine } = require("../helpers");
|
||||
const { addErrorContextForLine, isBlankLine } = require("../helpers");
|
||||
const { filterByPredicate, nonContentTokens } = require("../helpers/micromark.cjs");
|
||||
|
||||
const isList = (token) => (
|
||||
(token.type === "listOrdered") || (token.type === "listUnordered")
|
||||
);
|
||||
const addBlankLineError = (onError, lines, lineIndex, lineNumber) => {
|
||||
const line = lines[lineIndex];
|
||||
const quotePrefix = line.match(blockquotePrefixRe)[0].trimEnd();
|
||||
addErrorContext(
|
||||
onError,
|
||||
lineIndex + 1,
|
||||
line.trim(),
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
{
|
||||
lineNumber,
|
||||
"insertText": `${quotePrefix}\n`
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
// eslint-disable-next-line jsdoc/valid-types
|
||||
/** @type import("./markdownlint").Rule */
|
||||
|
|
@ -53,7 +37,12 @@ module.exports = {
|
|||
// Look for a blank line above the list
|
||||
const firstIndex = list.startLine - 1;
|
||||
if (!isBlankLine(lines[firstIndex - 1])) {
|
||||
addBlankLineError(onError, lines, firstIndex);
|
||||
addErrorContextForLine(
|
||||
onError,
|
||||
// @ts-ignore
|
||||
lines,
|
||||
firstIndex
|
||||
);
|
||||
}
|
||||
|
||||
// Find the "visual" end of the list
|
||||
|
|
@ -69,7 +58,13 @@ module.exports = {
|
|||
// Look for a blank line below the list
|
||||
const lastIndex = endLine - 1;
|
||||
if (!isBlankLine(lines[lastIndex + 1])) {
|
||||
addBlankLineError(onError, lines, lastIndex, lastIndex + 2);
|
||||
addErrorContextForLine(
|
||||
onError,
|
||||
// @ts-ignore
|
||||
lines,
|
||||
lastIndex,
|
||||
lastIndex + 2
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
48
lib/md058.js
Normal file
48
lib/md058.js
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
// @ts-check
|
||||
|
||||
"use strict";
|
||||
|
||||
const { addErrorContextForLine, isBlankLine } = require("../helpers");
|
||||
const { filterByTypes } = require("../helpers/micromark.cjs");
|
||||
|
||||
// eslint-disable-next-line jsdoc/valid-types
|
||||
/** @type import("./markdownlint").Rule */
|
||||
module.exports = {
|
||||
"names": [ "MD058", "blanks-around-tables" ],
|
||||
"description": "Tables should be surrounded by blank lines",
|
||||
"tags": [ "table" ],
|
||||
"parser": "micromark",
|
||||
"function": function MD058(params, onError) {
|
||||
// eslint-disable-next-line jsdoc/valid-types
|
||||
/** @type import("../helpers/micromark.cjs").Token[] */
|
||||
const micromarkTokens =
|
||||
// @ts-ignore
|
||||
params.parsers.micromark.tokens;
|
||||
const { lines } = params;
|
||||
// For every table...
|
||||
const tables = filterByTypes(micromarkTokens, [ "table" ]);
|
||||
for (const table of tables) {
|
||||
// Look for a blank line above the table
|
||||
const firstIndex = table.startLine - 1;
|
||||
if (!isBlankLine(lines[firstIndex - 1])) {
|
||||
addErrorContextForLine(
|
||||
onError,
|
||||
// @ts-ignore
|
||||
lines,
|
||||
firstIndex
|
||||
);
|
||||
}
|
||||
// Look for a blank line below the table
|
||||
const lastIndex = table.endLine - 1;
|
||||
if (!isBlankLine(lines[lastIndex + 1])) {
|
||||
addErrorContextForLine(
|
||||
onError,
|
||||
// @ts-ignore
|
||||
lines,
|
||||
lastIndex,
|
||||
lastIndex + 2
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
@ -55,8 +55,9 @@ const rules = [
|
|||
require("./md053"),
|
||||
require("./md054"),
|
||||
require("./md055"),
|
||||
require("./md056")
|
||||
require("./md056"),
|
||||
// md057: See https://github.com/markdownlint/markdownlint
|
||||
require("./md058")
|
||||
];
|
||||
for (const rule of rules) {
|
||||
const name = rule.names[0].toLowerCase();
|
||||
|
|
|
|||
|
|
@ -300,5 +300,8 @@
|
|||
},
|
||||
|
||||
// MD056/table-column-count : Table column count : https://github.com/DavidAnson/markdownlint/blob/v0.34.0/doc/md056.md
|
||||
"MD056": true
|
||||
"MD056": true,
|
||||
|
||||
// MD058/blanks-around-tables : Tables should be surrounded by blank lines : https://github.com/DavidAnson/markdownlint/blob/v0.34.0/doc/md058.md
|
||||
"MD058": true
|
||||
}
|
||||
|
|
@ -270,3 +270,6 @@ MD055:
|
|||
|
||||
# MD056/table-column-count : Table column count : https://github.com/DavidAnson/markdownlint/blob/v0.34.0/doc/md056.md
|
||||
MD056: true
|
||||
|
||||
# MD058/blanks-around-tables : Tables should be surrounded by blank lines : https://github.com/DavidAnson/markdownlint/blob/v0.34.0/doc/md058.md
|
||||
MD058: true
|
||||
|
|
|
|||
|
|
@ -1684,6 +1684,16 @@
|
|||
"type": "boolean",
|
||||
"default": true
|
||||
},
|
||||
"MD058": {
|
||||
"description": "MD058/blanks-around-tables : Tables should be surrounded by blank lines : https://github.com/DavidAnson/markdownlint/blob/v0.34.0/doc/md058.md",
|
||||
"type": "boolean",
|
||||
"default": true
|
||||
},
|
||||
"blanks-around-tables": {
|
||||
"description": "MD058/blanks-around-tables : Tables should be surrounded by blank lines : https://github.com/DavidAnson/markdownlint/blob/v0.34.0/doc/md058.md",
|
||||
"type": "boolean",
|
||||
"default": true
|
||||
},
|
||||
"headings": {
|
||||
"description": "headings : MD001, MD003, MD018, MD019, MD020, MD021, MD022, MD023, MD024, MD025, MD026, MD036, MD041, MD043",
|
||||
"type": "boolean",
|
||||
|
|
@ -1800,7 +1810,7 @@
|
|||
"default": true
|
||||
},
|
||||
"table": {
|
||||
"description": "table : MD055, MD056",
|
||||
"description": "table : MD055, MD056, MD058",
|
||||
"type": "boolean",
|
||||
"default": true
|
||||
}
|
||||
|
|
|
|||
51
test/blanks-around-tables.md
Normal file
51
test/blanks-around-tables.md
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
# Blanks Around Tables
|
||||
|
||||
| Header | Header |
|
||||
| ------ | ------ |
|
||||
| Cell | Cell |
|
||||
|
||||
Text
|
||||
| Header | {MD058} |
|
||||
| ------ | ------- |
|
||||
| Cell | Cell |
|
||||
|
||||
| Header | Header |
|
||||
| ------ | ------ |
|
||||
| Cell | Cell |
|
||||
Part of table {MD055} {MD056}
|
||||
|
||||
| Header | Header |
|
||||
| ------ | ------- |
|
||||
| Cell | {MD058} |
|
||||
> Blockquote
|
||||
|
||||
Text
|
||||
|
||||
> Text
|
||||
> | Header | {MD058} |
|
||||
> | ------ | ------- |
|
||||
> | Cell | {MD058} |
|
||||
Text
|
||||
|
||||
> | Header | Header |
|
||||
> | ------ | ------- |
|
||||
> | Cell | {MD058} |
|
||||
> > Blockquote
|
||||
|
||||
- List Item
|
||||
| Header | {MD058} |
|
||||
| ------ | ------- |
|
||||
| Cell | {MD058} |
|
||||
- List Item
|
||||
|
||||
1. List Item
|
||||
| Header | {MD058} |
|
||||
| ------ | ------- |
|
||||
| Cell | {MD058} |
|
||||
1. List Item
|
||||
|
||||
:::directive
|
||||
| Header | {MD058} |
|
||||
| ------ | ------- |
|
||||
| Cell | {MD058} |
|
||||
:::
|
||||
|
|
@ -113,6 +113,12 @@ Strong **with** different style {MD050}
|
|||
|---------|--------|
|
||||
| {MD056} |
|
||||
|
||||
Text
|
||||
| table {MD058} |
|
||||
|-------|
|
||||
| cell {MD058} |
|
||||
> Blockquote
|
||||
|
||||
<!-- markdownlint-configure-file {
|
||||
"required-headings": {
|
||||
"headings": [
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ test("projectFiles", (t) => {
|
|||
return import("globby")
|
||||
.then((module) => module.globby(projectFiles))
|
||||
.then((files) => {
|
||||
t.is(files.length, 60);
|
||||
t.is(files.length, 61);
|
||||
const options = {
|
||||
files,
|
||||
"config": require("../.markdownlint.json")
|
||||
|
|
@ -113,7 +113,7 @@ test("projectFilesExtendedAscii", (t) => {
|
|||
"!doc/md036.md"
|
||||
]))
|
||||
.then((files) => {
|
||||
t.is(files.length, 56);
|
||||
t.is(files.length, 57);
|
||||
const options = {
|
||||
files,
|
||||
"config": require("../.markdownlint.json"),
|
||||
|
|
@ -506,7 +506,7 @@ test("styleAll", async(t) => {
|
|||
"MD042": [ 81 ],
|
||||
"MD045": [ 85 ],
|
||||
"MD046": [ 49, 73, 77 ],
|
||||
"MD047": [ 134 ],
|
||||
"MD047": [ 140 ],
|
||||
"MD048": [ 77 ],
|
||||
"MD049": [ 90 ],
|
||||
"MD050": [ 94 ],
|
||||
|
|
@ -514,7 +514,8 @@ test("styleAll", async(t) => {
|
|||
"MD052": [ 98 ],
|
||||
"MD053": [ 100 ],
|
||||
"MD055": [ 110 ],
|
||||
"MD056": [ 114 ]
|
||||
"MD056": [ 114 ],
|
||||
"MD058": [ 117, 119 ]
|
||||
}
|
||||
};
|
||||
t.deepEqual(actualResult, expectedResult, "Undetected issues.");
|
||||
|
|
@ -553,7 +554,7 @@ test("styleRelaxed", async(t) => {
|
|||
"MD042": [ 81 ],
|
||||
"MD045": [ 85 ],
|
||||
"MD046": [ 49, 73, 77 ],
|
||||
"MD047": [ 134 ],
|
||||
"MD047": [ 140 ],
|
||||
"MD048": [ 77 ],
|
||||
"MD049": [ 90 ],
|
||||
"MD050": [ 94 ],
|
||||
|
|
@ -561,7 +562,8 @@ test("styleRelaxed", async(t) => {
|
|||
"MD052": [ 98 ],
|
||||
"MD053": [ 100 ],
|
||||
"MD055": [ 110 ],
|
||||
"MD056": [ 114 ]
|
||||
"MD056": [ 114 ],
|
||||
"MD058": [ 117, 119 ]
|
||||
}
|
||||
};
|
||||
t.deepEqual(actualResult, expectedResult, "Undetected issues.");
|
||||
|
|
@ -868,7 +870,7 @@ test("customFileSystemAsync", (t) => new Promise((resolve) => {
|
|||
}));
|
||||
|
||||
test("readme", async(t) => {
|
||||
t.plan(126);
|
||||
t.plan(128);
|
||||
const tagToRules = {};
|
||||
for (const rule of rules) {
|
||||
for (const tag of rule.tags) {
|
||||
|
|
@ -1067,7 +1069,7 @@ test("validateConfigExampleJson", (t) => {
|
|||
});
|
||||
|
||||
test("allBuiltInRulesHaveValidUrl", (t) => {
|
||||
t.plan(150);
|
||||
t.plan(153);
|
||||
for (const rule of rules) {
|
||||
// @ts-ignore
|
||||
t.truthy(rule.information);
|
||||
|
|
|
|||
|
|
@ -8,4 +8,40 @@ Generated by [AVA](https://avajs.dev).
|
|||
|
||||
> Expected linting violations
|
||||
|
||||
''
|
||||
`test-repos/dotnet-docs/docs/core/compatibility/windows-forms/5.0/invalid-args-cause-argumentoutofrangeexception.md: 30: MD058/blanks-around-tables Tables should be surrounded by blank lines [Context: "> | Property | Parameter name ..."]␊
|
||||
test-repos/dotnet-docs/docs/core/compatibility/windows-forms/5.0/null-args-cause-argumentnullexception.md: 29: MD058/blanks-around-tables Tables should be surrounded by blank lines [Context: "> | Method | Parameter name | ..."]␊
|
||||
test-repos/dotnet-docs/docs/core/compatibility/windows-forms/5.0/null-owner-causes-invalidoperationexception.md: 31: MD058/blanks-around-tables Tables should be surrounded by blank lines [Context: "> | Affected method or propert..."]␊
|
||||
test-repos/dotnet-docs/docs/framework/whats-new/obsolete-members.md: 20: MD058/blanks-around-tables Tables should be surrounded by blank lines [Context: "> |Type|Member|Message|"]␊
|
||||
test-repos/dotnet-docs/docs/framework/whats-new/obsolete-members.md: 186: MD058/blanks-around-tables Tables should be surrounded by blank lines [Context: "> |Type|Member|Message|"]␊
|
||||
test-repos/dotnet-docs/docs/framework/whats-new/obsolete-members.md: 226: MD058/blanks-around-tables Tables should be surrounded by blank lines [Context: "> |Type|Member|Message|"]␊
|
||||
test-repos/dotnet-docs/docs/framework/whats-new/obsolete-members.md: 236: MD058/blanks-around-tables Tables should be surrounded by blank lines [Context: "> |Type|Member|Message|"]␊
|
||||
test-repos/dotnet-docs/docs/framework/whats-new/obsolete-members.md: 244: MD058/blanks-around-tables Tables should be surrounded by blank lines [Context: "> |Type|Member|Message|"]␊
|
||||
test-repos/dotnet-docs/docs/framework/whats-new/obsolete-members.md: 259: MD058/blanks-around-tables Tables should be surrounded by blank lines [Context: "> |Type|Member|Message|"]␊
|
||||
test-repos/dotnet-docs/docs/framework/whats-new/obsolete-members.md: 302: MD058/blanks-around-tables Tables should be surrounded by blank lines [Context: "> |Type|Member|Message|"]␊
|
||||
test-repos/dotnet-docs/docs/framework/whats-new/obsolete-members.md: 324: MD058/blanks-around-tables Tables should be surrounded by blank lines [Context: "> |Type|Member|Message|"]␊
|
||||
test-repos/dotnet-docs/docs/framework/whats-new/obsolete-members.md: 334: MD058/blanks-around-tables Tables should be surrounded by blank lines [Context: "> |Type|Member|Message|"]␊
|
||||
test-repos/dotnet-docs/docs/framework/whats-new/obsolete-members.md: 343: MD058/blanks-around-tables Tables should be surrounded by blank lines [Context: "> |Type|Member|Message|"]␊
|
||||
test-repos/dotnet-docs/docs/framework/whats-new/obsolete-members.md: 396: MD058/blanks-around-tables Tables should be surrounded by blank lines [Context: "> |Type|Member|Message|"]␊
|
||||
test-repos/dotnet-docs/docs/framework/whats-new/obsolete-members.md: 508: MD058/blanks-around-tables Tables should be surrounded by blank lines [Context: "> |Type|Member|Message|"]␊
|
||||
test-repos/dotnet-docs/docs/framework/whats-new/obsolete-members.md: 516: MD058/blanks-around-tables Tables should be surrounded by blank lines [Context: "> |Type|Member|Message|"]␊
|
||||
test-repos/dotnet-docs/docs/framework/whats-new/obsolete-members.md: 524: MD058/blanks-around-tables Tables should be surrounded by blank lines [Context: "> |Type|Member|Message|"]␊
|
||||
test-repos/dotnet-docs/docs/framework/whats-new/obsolete-members.md: 536: MD058/blanks-around-tables Tables should be surrounded by blank lines [Context: "> |Type|Member|Message|"]␊
|
||||
test-repos/dotnet-docs/docs/framework/whats-new/obsolete-members.md: 544: MD058/blanks-around-tables Tables should be surrounded by blank lines [Context: "> |Type|Member|Message|"]␊
|
||||
test-repos/dotnet-docs/docs/framework/whats-new/obsolete-members.md: 551: MD058/blanks-around-tables Tables should be surrounded by blank lines [Context: "> |Type|Member|Message|"]␊
|
||||
test-repos/dotnet-docs/docs/framework/whats-new/obsolete-members.md: 586: MD058/blanks-around-tables Tables should be surrounded by blank lines [Context: "> |Type|Member|Message|"]␊
|
||||
test-repos/dotnet-docs/docs/framework/whats-new/obsolete-members.md: 593: MD058/blanks-around-tables Tables should be surrounded by blank lines [Context: "> |Type|Member|Message|"]␊
|
||||
test-repos/dotnet-docs/docs/framework/whats-new/obsolete-members.md: 607: MD058/blanks-around-tables Tables should be surrounded by blank lines [Context: "> |Type|Member|Message|"]␊
|
||||
test-repos/dotnet-docs/docs/framework/whats-new/obsolete-members.md: 615: MD058/blanks-around-tables Tables should be surrounded by blank lines [Context: "> |Type|Member|Message|"]␊
|
||||
test-repos/dotnet-docs/docs/framework/whats-new/obsolete-members.md: 632: MD058/blanks-around-tables Tables should be surrounded by blank lines [Context: "> |Type|Member|Message|"]␊
|
||||
test-repos/dotnet-docs/docs/framework/whats-new/obsolete-members.md: 640: MD058/blanks-around-tables Tables should be surrounded by blank lines [Context: "> |Type|Member|Message|"]␊
|
||||
test-repos/dotnet-docs/docs/framework/whats-new/obsolete-members.md: 666: MD058/blanks-around-tables Tables should be surrounded by blank lines [Context: "> |Type|Member|Message|"]␊
|
||||
test-repos/dotnet-docs/docs/framework/whats-new/obsolete-members.md: 673: MD058/blanks-around-tables Tables should be surrounded by blank lines [Context: "> |Type|Member|Message|"]␊
|
||||
test-repos/dotnet-docs/docs/framework/whats-new/obsolete-members.md: 683: MD058/blanks-around-tables Tables should be surrounded by blank lines [Context: "> |Type|Member|Message|"]␊
|
||||
test-repos/dotnet-docs/docs/framework/whats-new/obsolete-members.md: 691: MD058/blanks-around-tables Tables should be surrounded by blank lines [Context: "> |Type|Member|Message|"]␊
|
||||
test-repos/dotnet-docs/docs/framework/whats-new/obsolete-members.md: 698: MD058/blanks-around-tables Tables should be surrounded by blank lines [Context: "> |Type|Member|Message|"]␊
|
||||
test-repos/dotnet-docs/docs/framework/whats-new/obsolete-members.md: 705: MD058/blanks-around-tables Tables should be surrounded by blank lines [Context: "> |Type|Member|Message|"]␊
|
||||
test-repos/dotnet-docs/docs/framework/whats-new/obsolete-members.md: 712: MD058/blanks-around-tables Tables should be surrounded by blank lines [Context: "> |Type|Member|Message|"]␊
|
||||
test-repos/dotnet-docs/docs/fundamentals/code-analysis/quality-rules/index.md: 15: MD058/blanks-around-tables Tables should be surrounded by blank lines [Context: "> | Rule ID and warning | Desc..."]␊
|
||||
test-repos/dotnet-docs/docs/fundamentals/code-analysis/style-rules/index.md: 35: MD058/blanks-around-tables Tables should be surrounded by blank lines [Context: "> | Rule ID | Title | Option |"]␊
|
||||
test-repos/dotnet-docs/docs/standard/base-types/regular-expressions.md: 91: MD058/blanks-around-tables Tables should be surrounded by blank lines [Context: "> |Pattern|Interpretation|"]␊
|
||||
test-repos/dotnet-docs/docs/standard/base-types/regular-expressions.md: 113: MD058/blanks-around-tables Tables should be surrounded by blank lines [Context: "> |Pattern|Interpretation|"]`
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -8,4 +8,5 @@ Generated by [AVA](https://avajs.dev).
|
|||
|
||||
> Expected linting violations
|
||||
|
||||
''
|
||||
`test-repos/mdn-content/files/en-us/web/api/wheelevent/wheelevent/index.md: 41: MD058/blanks-around-tables Tables should be surrounded by blank lines [Context: "| Constant | Value | Descripti..."]␊
|
||||
test-repos/mdn-content/files/en-us/web/css/basic-shape/polygon/index.md: 55: MD058/blanks-around-tables Tables should be surrounded by blank lines [Context: "| axis | point 1 | point 2 | p..."]`
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -224,7 +224,15 @@ Generated by [AVA](https://avajs.dev).
|
|||
|
||||
> Expected linting violations
|
||||
|
||||
`test-repos/v8-v8-dev/src/blog/oilpan-pointer-compression.md: 84: MD055/table-pipe-style Table pipe style [Expected: leading_and_trailing; Actual: leading_only; Missing trailing pipe]␊
|
||||
`test-repos/v8-v8-dev/src/blog/fast-for-in.md: 271: MD058/blanks-around-tables Tables should be surrounded by blank lines [Context: "| Internal method | Hand..."]␊
|
||||
test-repos/v8-v8-dev/src/blog/fast-for-in.md: 277: MD058/blanks-around-tables Tables should be surrounded by blank lines [Context: "| \`[[OwnPropertyKeys]]\` | \`own..."]␊
|
||||
test-repos/v8-v8-dev/src/blog/fast-for-in.md: 351: MD058/blanks-around-tables Tables should be surrounded by blank lines [Context: "| Position | Name ..."]␊
|
||||
test-repos/v8-v8-dev/src/blog/fast-for-in.md: 369: MD058/blanks-around-tables Tables should be surrounded by blank lines [Context: "| 17 | \`ForInFilter\` ..."]␊
|
||||
test-repos/v8-v8-dev/src/blog/lazy-unlinking.md: 183: MD058/blanks-around-tables Tables should be surrounded by blank lines [Context: "| Benchmark | Kind ..."]␊
|
||||
test-repos/v8-v8-dev/src/blog/lazy-unlinking.md: 188: MD058/blanks-around-tables Tables should be surrounded by blank lines [Context: "| youtube.com | Average size ..."]␊
|
||||
test-repos/v8-v8-dev/src/blog/maglev.md: 143: MD058/blanks-around-tables Tables should be surrounded by blank lines [Context: "| Benchmark | Energy Consump..."]␊
|
||||
test-repos/v8-v8-dev/src/blog/maglev.md: 146: MD058/blanks-around-tables Tables should be surrounded by blank lines [Context: "| Speedometer | -10% ..."]␊
|
||||
test-repos/v8-v8-dev/src/blog/oilpan-pointer-compression.md: 84: MD055/table-pipe-style Table pipe style [Expected: leading_and_trailing; Actual: leading_only; Missing trailing pipe]␊
|
||||
test-repos/v8-v8-dev/src/blog/oilpan-pointer-compression.md: 85: MD055/table-pipe-style Table pipe style [Expected: leading_and_trailing; Actual: leading_only; Missing trailing pipe]␊
|
||||
test-repos/v8-v8-dev/src/blog/oilpan-pointer-compression.md: 86: MD055/table-pipe-style Table pipe style [Expected: leading_and_trailing; Actual: leading_only; Missing trailing pipe]␊
|
||||
test-repos/v8-v8-dev/src/blog/oilpan-pointer-compression.md: 87: MD055/table-pipe-style Table pipe style [Expected: leading_and_trailing; Actual: leading_only; Missing trailing pipe]␊
|
||||
|
|
@ -261,6 +269,12 @@ Generated by [AVA](https://avajs.dev).
|
|||
test-repos/v8-v8-dev/src/blog/oilpan-pointer-compression.md: 199: MD055/table-pipe-style Table pipe style [Expected: leading_and_trailing; Actual: leading_only; Missing trailing pipe]␊
|
||||
test-repos/v8-v8-dev/src/blog/oilpan-pointer-compression.md: 200: MD055/table-pipe-style Table pipe style [Expected: leading_and_trailing; Actual: leading_only; Missing trailing pipe]␊
|
||||
test-repos/v8-v8-dev/src/blog/oilpan-pointer-compression.md: 201: MD055/table-pipe-style Table pipe style [Expected: leading_and_trailing; Actual: leading_only; Missing trailing pipe]␊
|
||||
test-repos/v8-v8-dev/src/blog/oilpan-pointer-compression.md: 82: MD058/blanks-around-tables Tables should be surrounded by blank lines [Context: "| C++ ..."]␊
|
||||
test-repos/v8-v8-dev/src/blog/oilpan-pointer-compression.md: 88: MD058/blanks-around-tables Tables should be surrounded by blank lines [Context: "| \`\`\` ..."]␊
|
||||
test-repos/v8-v8-dev/src/blog/oilpan-pointer-compression.md: 131: MD058/blanks-around-tables Tables should be surrounded by blank lines [Context: "| C++ ..."]␊
|
||||
test-repos/v8-v8-dev/src/blog/oilpan-pointer-compression.md: 139: MD058/blanks-around-tables Tables should be surrounded by blank lines [Context: "| \`\`\` ..."]␊
|
||||
test-repos/v8-v8-dev/src/blog/oilpan-pointer-compression.md: 185: MD058/blanks-around-tables Tables should be surrounded by blank lines [Context: "| C++ ..."]␊
|
||||
test-repos/v8-v8-dev/src/blog/oilpan-pointer-compression.md: 202: MD058/blanks-around-tables Tables should be surrounded by blank lines [Context: "| \`\`\` ..."]␊
|
||||
test-repos/v8-v8-dev/src/blog/pointer-compression.md: 192: MD055/table-pipe-style Table pipe style [Expected: leading_and_trailing; Actual: leading_only; Missing trailing pipe]␊
|
||||
test-repos/v8-v8-dev/src/blog/pointer-compression.md: 193: MD055/table-pipe-style Table pipe style [Expected: leading_and_trailing; Actual: leading_only; Missing trailing pipe]␊
|
||||
test-repos/v8-v8-dev/src/blog/pointer-compression.md: 194: MD055/table-pipe-style Table pipe style [Expected: leading_and_trailing; Actual: leading_only; Missing trailing pipe]␊
|
||||
|
|
@ -284,11 +298,17 @@ Generated by [AVA](https://avajs.dev).
|
|||
test-repos/v8-v8-dev/src/blog/pointer-compression.md: 333: MD056/table-column-count Table column count [Expected: 3; Actual: 4; Too many cells, extra data will be missing]␊
|
||||
test-repos/v8-v8-dev/src/blog/pointer-compression.md: 334: MD056/table-column-count Table column count [Expected: 3; Actual: 4; Too many cells, extra data will be missing]␊
|
||||
test-repos/v8-v8-dev/src/blog/pointer-compression.md: 335: MD056/table-column-count Table column count [Expected: 3; Actual: 4; Too many cells, extra data will be missing]␊
|
||||
test-repos/v8-v8-dev/src/blog/react-cliff.md: 81: MD058/blanks-around-tables Tables should be surrounded by blank lines [Context: "| representation ..."]␊
|
||||
test-repos/v8-v8-dev/src/blog/react-cliff.md: 87: MD058/blanks-around-tables Tables should be surrounded by blank lines [Context: "| 64-bit IEEE-754 floating-poi..."]␊
|
||||
test-repos/v8-v8-dev/src/blog/understanding-ecmascript-part-1.md: 41: MD032/blanks-around-lists Lists should be surrounded by blank lines [Context: "> 3. Return \`? HasOwnProperty(..."]␊
|
||||
test-repos/v8-v8-dev/src/blog/understanding-ecmascript-part-1.md: 55: MD032/blanks-around-lists Lists should be surrounded by blank lines [Context: "> 5. Return \`true\`."]␊
|
||||
test-repos/v8-v8-dev/src/blog/understanding-ecmascript-part-1.md: 91: MD032/blanks-around-lists Lists should be surrounded by blank lines [Context: "> 1. Return \`! OrdinaryGetOwnP..."]␊
|
||||
test-repos/v8-v8-dev/src/blog/understanding-ecmascript-part-1.md: 177: MD032/blanks-around-lists Lists should be surrounded by blank lines [Context: "> 10. Return \`NormalCompletion..."]␊
|
||||
test-repos/v8-v8-dev/src/blog/understanding-ecmascript-part-1.md: 191: MD032/blanks-around-lists Lists should be surrounded by blank lines [Context: "> 7. Return \`NormalCompletion(..."]␊
|
||||
test-repos/v8-v8-dev/src/blog/understanding-ecmascript-part-1.md: 113: MD058/blanks-around-tables Tables should be surrounded by blank lines [Context: "| Name | Description ..."]␊
|
||||
test-repos/v8-v8-dev/src/blog/understanding-ecmascript-part-1.md: 117: MD058/blanks-around-tables Tables should be surrounded by blank lines [Context: "| \`[[Target]]\` | Used for dire..."]␊
|
||||
test-repos/v8-v8-dev/src/blog/v8-release-80.md: 46: MD058/blanks-around-tables Tables should be surrounded by blank lines [Context: "| || Des..."]␊
|
||||
test-repos/v8-v8-dev/src/blog/v8-release-80.md: 53: MD058/blanks-around-tables Tables should be surrounded by blank lines [Context: "| ^^ | GC | -7%..."]␊
|
||||
test-repos/v8-v8-dev/src/docs/become-committer.md: 32: MD034/no-bare-urls Bare URL used [Context: "v8-committers@googlegroups.com"]␊
|
||||
test-repos/v8-v8-dev/src/docs/design-review-guidelines.md: 41: MD034/no-bare-urls Bare URL used [Context: "v8-eng-review-owners@googlegro..."]␊
|
||||
test-repos/v8-v8-dev/src/docs/design-review-guidelines.md: 78: MD034/no-bare-urls Bare URL used [Context: "v8-dev@googlegroups.com"]␊
|
||||
|
|
@ -298,6 +318,8 @@ Generated by [AVA](https://avajs.dev).
|
|||
test-repos/v8-v8-dev/src/docs/feature-launch-process.md: 9: MD034/no-bare-urls Bare URL used [Context: "gdeepti@chromium.org"]␊
|
||||
test-repos/v8-v8-dev/src/docs/feature-launch-process.md: 9: MD034/no-bare-urls Bare URL used [Context: "v8-dev@googlegroups.com"]␊
|
||||
test-repos/v8-v8-dev/src/docs/official-support.md: 19: MD034/no-bare-urls Bare URL used [Context: "v8-dev@googlegroups.com"]␊
|
||||
test-repos/v8-v8-dev/src/docs/respectful-code.md: 36: MD058/blanks-around-tables Tables should be surrounded by blank lines [Context: "| Term | Suggested altern..."]␊
|
||||
test-repos/v8-v8-dev/src/docs/respectful-code.md: 45: MD058/blanks-around-tables Tables should be surrounded by blank lines [Context: "| redline | priority line, l..."]␊
|
||||
test-repos/v8-v8-dev/src/feature-support.md: 11: MD033/no-inline-html Inline HTML [Element: feature-support]␊
|
||||
test-repos/v8-v8-dev/src/feature-support.md: 19: MD033/no-inline-html Inline HTML [Element: feature-support]␊
|
||||
test-repos/v8-v8-dev/src/feature-support.md: 27: MD033/no-inline-html Inline HTML [Element: feature-support]␊
|
||||
|
|
@ -324,6 +346,8 @@ Generated by [AVA](https://avajs.dev).
|
|||
test-repos/v8-v8-dev/src/features/import-attributes.md: 63: MD034/no-bare-urls Bare URL used [Context: "https://babeljs.io/blog/2023/0..."]␊
|
||||
test-repos/v8-v8-dev/src/features/intl-displaynames.md: 110: MD033/no-inline-html Inline HTML [Element: feature-support]␊
|
||||
test-repos/v8-v8-dev/src/features/intl-listformat.md: 91: MD033/no-inline-html Inline HTML [Element: feature-support]␊
|
||||
test-repos/v8-v8-dev/src/features/intl-listformat.md: 74: MD058/blanks-around-tables Tables should be surrounded by blank lines [Context: "| Type | Opti..."]␊
|
||||
test-repos/v8-v8-dev/src/features/intl-listformat.md: 80: MD058/blanks-around-tables Tables should be surrounded by blank lines [Context: "| unit-narrow | \`{ t..."]␊
|
||||
test-repos/v8-v8-dev/src/features/intl-numberformat.md: 16: MD033/no-inline-html Inline HTML [Element: feature-support]␊
|
||||
test-repos/v8-v8-dev/src/features/intl-numberformat.md: 58: MD033/no-inline-html Inline HTML [Element: feature-support]␊
|
||||
test-repos/v8-v8-dev/src/features/intl-numberformat.md: 104: MD033/no-inline-html Inline HTML [Element: feature-support]␊
|
||||
|
|
@ -348,6 +372,8 @@ Generated by [AVA](https://avajs.dev).
|
|||
test-repos/v8-v8-dev/src/features/promise-combinators.md: 66: MD033/no-inline-html Inline HTML [Element: feature-support]␊
|
||||
test-repos/v8-v8-dev/src/features/promise-combinators.md: 95: MD033/no-inline-html Inline HTML [Element: feature-support]␊
|
||||
test-repos/v8-v8-dev/src/features/promise-combinators.md: 120: MD033/no-inline-html Inline HTML [Element: feature-support]␊
|
||||
test-repos/v8-v8-dev/src/features/promise-combinators.md: 23: MD058/blanks-around-tables Tables should be surrounded by blank lines [Context: "| name ..."]␊
|
||||
test-repos/v8-v8-dev/src/features/promise-combinators.md: 28: MD058/blanks-around-tables Tables should be surrounded by blank lines [Context: "| [\`Promise.any\`](#promise.any..."]␊
|
||||
test-repos/v8-v8-dev/src/features/promise-finally.md: 82: MD033/no-inline-html Inline HTML [Element: feature-support]␊
|
||||
test-repos/v8-v8-dev/src/features/regexp-match-indices.md: 134: MD033/no-inline-html Inline HTML [Element: feature-support]␊
|
||||
test-repos/v8-v8-dev/src/features/regexp-v-flag.md: 254: MD033/no-inline-html Inline HTML [Element: feature-support]␊
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -4913,6 +4913,308 @@ Generated by [AVA](https://avajs.dev).
|
|||
`,
|
||||
}
|
||||
|
||||
## blanks-around-tables.md
|
||||
|
||||
> Snapshot 1
|
||||
|
||||
{
|
||||
errors: [
|
||||
{
|
||||
errorContext: null,
|
||||
errorDetail: 'Expected: leading_and_trailing; Actual: no_leading_or_trailing; Missing leading pipe',
|
||||
errorRange: [
|
||||
1,
|
||||
1,
|
||||
],
|
||||
fixInfo: null,
|
||||
lineNumber: 15,
|
||||
ruleDescription: 'Table pipe style',
|
||||
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md055.md',
|
||||
ruleNames: [
|
||||
'MD055',
|
||||
'table-pipe-style',
|
||||
],
|
||||
},
|
||||
{
|
||||
errorContext: null,
|
||||
errorDetail: 'Expected: leading_and_trailing; Actual: no_leading_or_trailing; Missing trailing pipe',
|
||||
errorRange: [
|
||||
29,
|
||||
1,
|
||||
],
|
||||
fixInfo: null,
|
||||
lineNumber: 15,
|
||||
ruleDescription: 'Table pipe style',
|
||||
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md055.md',
|
||||
ruleNames: [
|
||||
'MD055',
|
||||
'table-pipe-style',
|
||||
],
|
||||
},
|
||||
{
|
||||
errorContext: null,
|
||||
errorDetail: 'Expected: 2; Actual: 1; Too few cells, row will be missing data',
|
||||
errorRange: [
|
||||
29,
|
||||
1,
|
||||
],
|
||||
fixInfo: null,
|
||||
lineNumber: 15,
|
||||
ruleDescription: 'Table column count',
|
||||
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md056.md',
|
||||
ruleNames: [
|
||||
'MD056',
|
||||
'table-column-count',
|
||||
],
|
||||
},
|
||||
{
|
||||
errorContext: '| Header | {MD058} |',
|
||||
errorDetail: null,
|
||||
errorRange: null,
|
||||
fixInfo: {
|
||||
insertText: `␊
|
||||
`,
|
||||
},
|
||||
lineNumber: 8,
|
||||
ruleDescription: 'Tables should be surrounded by blank lines',
|
||||
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md058.md',
|
||||
ruleNames: [
|
||||
'MD058',
|
||||
'blanks-around-tables',
|
||||
],
|
||||
},
|
||||
{
|
||||
errorContext: '| Cell | {MD058} |',
|
||||
errorDetail: null,
|
||||
errorRange: null,
|
||||
fixInfo: {
|
||||
insertText: `␊
|
||||
`,
|
||||
lineNumber: 20,
|
||||
},
|
||||
lineNumber: 19,
|
||||
ruleDescription: 'Tables should be surrounded by blank lines',
|
||||
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md058.md',
|
||||
ruleNames: [
|
||||
'MD058',
|
||||
'blanks-around-tables',
|
||||
],
|
||||
},
|
||||
{
|
||||
errorContext: '> | Header | {MD058} |',
|
||||
errorDetail: null,
|
||||
errorRange: null,
|
||||
fixInfo: {
|
||||
insertText: `>␊
|
||||
`,
|
||||
},
|
||||
lineNumber: 25,
|
||||
ruleDescription: 'Tables should be surrounded by blank lines',
|
||||
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md058.md',
|
||||
ruleNames: [
|
||||
'MD058',
|
||||
'blanks-around-tables',
|
||||
],
|
||||
},
|
||||
{
|
||||
errorContext: '> | Cell | {MD058} |',
|
||||
errorDetail: null,
|
||||
errorRange: null,
|
||||
fixInfo: {
|
||||
insertText: `>␊
|
||||
`,
|
||||
lineNumber: 28,
|
||||
},
|
||||
lineNumber: 27,
|
||||
ruleDescription: 'Tables should be surrounded by blank lines',
|
||||
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md058.md',
|
||||
ruleNames: [
|
||||
'MD058',
|
||||
'blanks-around-tables',
|
||||
],
|
||||
},
|
||||
{
|
||||
errorContext: '> | Cell | {MD058} |',
|
||||
errorDetail: null,
|
||||
errorRange: null,
|
||||
fixInfo: {
|
||||
insertText: `>␊
|
||||
`,
|
||||
lineNumber: 33,
|
||||
},
|
||||
lineNumber: 32,
|
||||
ruleDescription: 'Tables should be surrounded by blank lines',
|
||||
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md058.md',
|
||||
ruleNames: [
|
||||
'MD058',
|
||||
'blanks-around-tables',
|
||||
],
|
||||
},
|
||||
{
|
||||
errorContext: '| Header | {MD058} |',
|
||||
errorDetail: null,
|
||||
errorRange: null,
|
||||
fixInfo: {
|
||||
insertText: `␊
|
||||
`,
|
||||
},
|
||||
lineNumber: 36,
|
||||
ruleDescription: 'Tables should be surrounded by blank lines',
|
||||
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md058.md',
|
||||
ruleNames: [
|
||||
'MD058',
|
||||
'blanks-around-tables',
|
||||
],
|
||||
},
|
||||
{
|
||||
errorContext: '| Cell | {MD058} |',
|
||||
errorDetail: null,
|
||||
errorRange: null,
|
||||
fixInfo: {
|
||||
insertText: `␊
|
||||
`,
|
||||
lineNumber: 39,
|
||||
},
|
||||
lineNumber: 38,
|
||||
ruleDescription: 'Tables should be surrounded by blank lines',
|
||||
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md058.md',
|
||||
ruleNames: [
|
||||
'MD058',
|
||||
'blanks-around-tables',
|
||||
],
|
||||
},
|
||||
{
|
||||
errorContext: '| Header | {MD058} |',
|
||||
errorDetail: null,
|
||||
errorRange: null,
|
||||
fixInfo: {
|
||||
insertText: `␊
|
||||
`,
|
||||
},
|
||||
lineNumber: 42,
|
||||
ruleDescription: 'Tables should be surrounded by blank lines',
|
||||
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md058.md',
|
||||
ruleNames: [
|
||||
'MD058',
|
||||
'blanks-around-tables',
|
||||
],
|
||||
},
|
||||
{
|
||||
errorContext: '| Cell | {MD058} |',
|
||||
errorDetail: null,
|
||||
errorRange: null,
|
||||
fixInfo: {
|
||||
insertText: `␊
|
||||
`,
|
||||
lineNumber: 45,
|
||||
},
|
||||
lineNumber: 44,
|
||||
ruleDescription: 'Tables should be surrounded by blank lines',
|
||||
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md058.md',
|
||||
ruleNames: [
|
||||
'MD058',
|
||||
'blanks-around-tables',
|
||||
],
|
||||
},
|
||||
{
|
||||
errorContext: '| Header | {MD058} |',
|
||||
errorDetail: null,
|
||||
errorRange: null,
|
||||
fixInfo: {
|
||||
insertText: `␊
|
||||
`,
|
||||
},
|
||||
lineNumber: 48,
|
||||
ruleDescription: 'Tables should be surrounded by blank lines',
|
||||
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md058.md',
|
||||
ruleNames: [
|
||||
'MD058',
|
||||
'blanks-around-tables',
|
||||
],
|
||||
},
|
||||
{
|
||||
errorContext: '| Cell | {MD058} |',
|
||||
errorDetail: null,
|
||||
errorRange: null,
|
||||
fixInfo: {
|
||||
insertText: `␊
|
||||
`,
|
||||
lineNumber: 51,
|
||||
},
|
||||
lineNumber: 50,
|
||||
ruleDescription: 'Tables should be surrounded by blank lines',
|
||||
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md058.md',
|
||||
ruleNames: [
|
||||
'MD058',
|
||||
'blanks-around-tables',
|
||||
],
|
||||
},
|
||||
],
|
||||
fixed: `# Blanks Around Tables␊
|
||||
␊
|
||||
| Header | Header |␊
|
||||
| ------ | ------ |␊
|
||||
| Cell | Cell |␊
|
||||
␊
|
||||
Text␊
|
||||
␊
|
||||
| Header | {MD058} |␊
|
||||
| ------ | ------- |␊
|
||||
| Cell | Cell |␊
|
||||
␊
|
||||
| Header | Header |␊
|
||||
| ------ | ------ |␊
|
||||
| Cell | Cell |␊
|
||||
Part of table {MD055} {MD056}␊
|
||||
␊
|
||||
| Header | Header |␊
|
||||
| ------ | ------- |␊
|
||||
| Cell | {MD058} |␊
|
||||
␊
|
||||
> Blockquote␊
|
||||
␊
|
||||
Text␊
|
||||
␊
|
||||
> Text␊
|
||||
>␊
|
||||
> | Header | {MD058} |␊
|
||||
> | ------ | ------- |␊
|
||||
> | Cell | {MD058} |␊
|
||||
>␊
|
||||
Text␊
|
||||
␊
|
||||
> | Header | Header |␊
|
||||
> | ------ | ------- |␊
|
||||
> | Cell | {MD058} |␊
|
||||
>␊
|
||||
> > Blockquote␊
|
||||
␊
|
||||
- List Item␊
|
||||
␊
|
||||
| Header | {MD058} |␊
|
||||
| ------ | ------- |␊
|
||||
| Cell | {MD058} |␊
|
||||
␊
|
||||
- List Item␊
|
||||
␊
|
||||
1. List Item␊
|
||||
␊
|
||||
| Header | {MD058} |␊
|
||||
| ------ | ------- |␊
|
||||
| Cell | {MD058} |␊
|
||||
␊
|
||||
1. List Item␊
|
||||
␊
|
||||
:::directive␊
|
||||
␊
|
||||
| Header | {MD058} |␊
|
||||
| ------ | ------- |␊
|
||||
| Cell | {MD058} |␊
|
||||
␊
|
||||
:::␊
|
||||
`,
|
||||
}
|
||||
|
||||
## blanks-around.md
|
||||
|
||||
> Snapshot 1
|
||||
|
|
@ -7255,7 +7557,7 @@ Generated by [AVA](https://avajs.dev).
|
|||
insertText: `␊
|
||||
`,
|
||||
},
|
||||
lineNumber: 134,
|
||||
lineNumber: 140,
|
||||
ruleDescription: 'Files should end with a single newline character',
|
||||
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md047.md',
|
||||
ruleNames: [
|
||||
|
|
@ -7458,6 +7760,39 @@ Generated by [AVA](https://avajs.dev).
|
|||
'table-column-count',
|
||||
],
|
||||
},
|
||||
{
|
||||
errorContext: '| table {MD058} |',
|
||||
errorDetail: null,
|
||||
errorRange: null,
|
||||
fixInfo: {
|
||||
insertText: `␊
|
||||
`,
|
||||
},
|
||||
lineNumber: 117,
|
||||
ruleDescription: 'Tables should be surrounded by blank lines',
|
||||
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md058.md',
|
||||
ruleNames: [
|
||||
'MD058',
|
||||
'blanks-around-tables',
|
||||
],
|
||||
},
|
||||
{
|
||||
errorContext: '| cell {MD058} |',
|
||||
errorDetail: null,
|
||||
errorRange: null,
|
||||
fixInfo: {
|
||||
insertText: `␊
|
||||
`,
|
||||
lineNumber: 120,
|
||||
},
|
||||
lineNumber: 119,
|
||||
ruleDescription: 'Tables should be surrounded by blank lines',
|
||||
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md058.md',
|
||||
ruleNames: [
|
||||
'MD058',
|
||||
'blanks-around-tables',
|
||||
],
|
||||
},
|
||||
],
|
||||
fixed: `## Heading 1 {MD041:1}␊
|
||||
␊
|
||||
|
|
@ -7575,6 +7910,14 @@ Generated by [AVA](https://avajs.dev).
|
|||
|---------|--------|␊
|
||||
| {MD056} |␊
|
||||
␊
|
||||
Text␊
|
||||
␊
|
||||
| table {MD058} |␊
|
||||
|-------|␊
|
||||
| cell {MD058} |␊
|
||||
␊
|
||||
> Blockquote␊
|
||||
␊
|
||||
<!-- markdownlint-configure-file {␊
|
||||
"required-headings": {␊
|
||||
"headings": [␊
|
||||
|
|
|
|||
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue