markdownlint
Advanced tools
Comparing version 0.31.0 to 0.31.1
# Changelog | ||
## 0.31.1 | ||
- Improve MD032/MD034 | ||
- Update dependencies | ||
## 0.31.0 | ||
@@ -4,0 +9,0 @@ |
@@ -49,4 +49,3 @@ # `MD007` - Unordered list indentation | ||
issue for other Markdown parsers, which require 4-space indents. More | ||
information: [Markdown Style Guide][markdown-style-guide] and [Marked app\ | ||
support][marked-app-support]. | ||
information: [Markdown Style Guide][markdown-style-guide]. | ||
@@ -56,2 +55,1 @@ Note: See [Prettier.md](Prettier.md) for compatibility information. | ||
[markdown-style-guide]: https://cirosantilli.com/markdown-style-guide#indentation-of-content-inside-lists | ||
[marked-app-support]: http://support.markedapp.com/discussions/problems/21-sub-lists-not-indenting |
@@ -14,12 +14,14 @@ # `MD032` - Lists should be surrounded by blank lines | ||
Some text | ||
* Some | ||
* List | ||
* List item | ||
* List item | ||
1. Some | ||
2. List | ||
Some text | ||
1. List item | ||
2. List item | ||
*** | ||
``` | ||
To fix this, ensure that all lists have a blank line both before and after | ||
(except where the block is at the beginning or end of the document): | ||
In the first case above, text immediately precedes the unordered list. In the | ||
second case above, a thematic break immediately follows the ordered list. To fix | ||
violations of this rule, ensure that all lists have a blank line both before and | ||
after (except when the list is at the very beginning or end of the document): | ||
@@ -29,12 +31,27 @@ ```markdown | ||
* Some | ||
* List | ||
* List item | ||
* List item | ||
1. Some | ||
2. List | ||
1. List item | ||
2. List item | ||
Some text | ||
*** | ||
``` | ||
Rationale: Aside from aesthetic reasons, some parsers, including kramdown, will | ||
not parse lists that don't have blank lines before and after them. | ||
Note that the following case is **not** a violation of this rule: | ||
```markdown | ||
1. List item | ||
More item 1 | ||
2. List item | ||
More item 2 | ||
``` | ||
Although it is not indented, the text "More item 2" is referred to as a | ||
[lazy continuation line][lazy-continuation] and considered part of the second | ||
list item. | ||
Rationale: In addition to aesthetic reasons, some parsers, including kramdown, | ||
will not parse lists that don't have blank lines before and after them. | ||
[lazy-continuation]: https://spec.commonmark.org/0.30/#lazy-continuation-line |
@@ -357,4 +357,3 @@ # Rules | ||
issue for other Markdown parsers, which require 4-space indents. More | ||
information: [Markdown Style Guide][markdown-style-guide] and [Marked app\ | ||
support][marked-app-support]. | ||
information: [Markdown Style Guide][markdown-style-guide]. | ||
@@ -364,3 +363,2 @@ Note: See [Prettier.md](Prettier.md) for compatibility information. | ||
[markdown-style-guide]: https://cirosantilli.com/markdown-style-guide#indentation-of-content-inside-lists | ||
[marked-app-support]: http://support.markedapp.com/discussions/problems/21-sub-lists-not-indenting | ||
@@ -1354,12 +1352,14 @@ <a name="md009"></a> | ||
Some text | ||
* Some | ||
* List | ||
* List item | ||
* List item | ||
1. Some | ||
2. List | ||
Some text | ||
1. List item | ||
2. List item | ||
*** | ||
``` | ||
To fix this, ensure that all lists have a blank line both before and after | ||
(except where the block is at the beginning or end of the document): | ||
In the first case above, text immediately precedes the unordered list. In the | ||
second case above, a thematic break immediately follows the ordered list. To fix | ||
violations of this rule, ensure that all lists have a blank line both before and | ||
after (except when the list is at the very beginning or end of the document): | ||
@@ -1369,14 +1369,29 @@ ```markdown | ||
* Some | ||
* List | ||
* List item | ||
* List item | ||
1. Some | ||
2. List | ||
1. List item | ||
2. List item | ||
Some text | ||
*** | ||
``` | ||
Rationale: Aside from aesthetic reasons, some parsers, including kramdown, will | ||
not parse lists that don't have blank lines before and after them. | ||
Note that the following case is **not** a violation of this rule: | ||
```markdown | ||
1. List item | ||
More item 1 | ||
2. List item | ||
More item 2 | ||
``` | ||
Although it is not indented, the text "More item 2" is referred to as a | ||
[lazy continuation line][lazy-continuation] and considered part of the second | ||
list item. | ||
Rationale: In addition to aesthetic reasons, some parsers, including kramdown, | ||
will not parse lists that don't have blank lines before and after them. | ||
[lazy-continuation]: https://spec.commonmark.org/0.30/#lazy-continuation-line | ||
<a name="md033"></a> | ||
@@ -1383,0 +1398,0 @@ |
@@ -12,3 +12,3 @@ { | ||
"type": "git", | ||
"url": "https://github.com/DavidAnson/markdownlint.git" | ||
"url": "git+https://github.com/DavidAnson/markdownlint.git" | ||
}, | ||
@@ -15,0 +15,0 @@ "bugs": "https://github.com/DavidAnson/markdownlint/issues", |
@@ -14,2 +14,2 @@ // @ts-check | ||
module.exports.homepage = "https://github.com/DavidAnson/markdownlint"; | ||
module.exports.version = "0.31.0"; | ||
module.exports.version = "0.31.1"; |
@@ -6,3 +6,3 @@ // @ts-check | ||
const { addErrorContext } = require("../helpers"); | ||
const { filterByPredicate, getHtmlTagInfo, parse } = | ||
const { filterByPredicate, filterByTypes, getHtmlTagInfo, parse } = | ||
require("../helpers/micromark.cjs"); | ||
@@ -15,38 +15,36 @@ | ||
"function": function MD034(params, onError) { | ||
const literalAutolinks = (tokens) => ( | ||
filterByPredicate( | ||
tokens, | ||
(token) => token.type === "literalAutolink", | ||
(token) => { | ||
const { children } = token; | ||
const result = []; | ||
for (let i = 0; i < children.length; i++) { | ||
const openToken = children[i]; | ||
const openTagInfo = getHtmlTagInfo(openToken); | ||
if (openTagInfo && !openTagInfo.close) { | ||
let count = 1; | ||
for (let j = i + 1; j < children.length; j++) { | ||
const closeToken = children[j]; | ||
const closeTagInfo = getHtmlTagInfo(closeToken); | ||
if (closeTagInfo && (openTagInfo.name === closeTagInfo.name)) { | ||
if (closeTagInfo.close) { | ||
count--; | ||
if (count === 0) { | ||
i = j; | ||
break; | ||
} | ||
} else { | ||
count++; | ||
} | ||
const literalAutolinks = (tokens) => { | ||
const flattened = filterByPredicate(tokens, () => true); | ||
const result = []; | ||
for (let i = 0; i < flattened.length; i++) { | ||
const current = flattened[i]; | ||
const openTagInfo = getHtmlTagInfo(current); | ||
if (openTagInfo && !openTagInfo.close) { | ||
let count = 1; | ||
for (let j = i + 1; j < flattened.length; j++) { | ||
const candidate = flattened[j]; | ||
const closeTagInfo = getHtmlTagInfo(candidate); | ||
if (closeTagInfo && (openTagInfo.name === closeTagInfo.name)) { | ||
if (closeTagInfo.close) { | ||
count--; | ||
if (count === 0) { | ||
i = j; | ||
break; | ||
} | ||
} else { | ||
count++; | ||
} | ||
} else { | ||
result.push(openToken); | ||
} | ||
} | ||
return result; | ||
} else { | ||
result.push(current); | ||
} | ||
) | ||
} | ||
return result.filter((token) => token.type === "literalAutolink"); | ||
}; | ||
const autoLinks = filterByTypes( | ||
params.parsers.micromark.tokens, | ||
[ "literalAutolink" ] | ||
); | ||
if (literalAutolinks(params.parsers.micromark.tokens).length > 0) { | ||
if (autoLinks.length > 0) { | ||
// Re-parse with correct link/image reference definition handling | ||
@@ -53,0 +51,0 @@ const document = params.lines.join("\n"); |
{ | ||
"name": "markdownlint", | ||
"version": "0.31.0", | ||
"version": "0.31.1", | ||
"description": "A Node.js style checker and lint tool for Markdown/CommonMark files.", | ||
@@ -21,3 +21,3 @@ "type": "commonjs", | ||
"type": "git", | ||
"url": "https://github.com/DavidAnson/markdownlint.git" | ||
"url": "git+https://github.com/DavidAnson/markdownlint.git" | ||
}, | ||
@@ -72,3 +72,3 @@ "bugs": "https://github.com/DavidAnson/markdownlint/issues", | ||
"devDependencies": { | ||
"@babel/core": "7.22.15", | ||
"@babel/core": "7.22.19", | ||
"@babel/preset-env": "7.22.15", | ||
@@ -79,6 +79,6 @@ "ava": "5.3.1", | ||
"character-entities": "2.0.2", | ||
"eslint": "8.48.0", | ||
"eslint": "8.49.0", | ||
"eslint-plugin-es": "4.1.0", | ||
"eslint-plugin-jsdoc": "46.5.1", | ||
"eslint-plugin-n": "16.0.2", | ||
"eslint-plugin-jsdoc": "46.8.0", | ||
"eslint-plugin-n": "16.1.0", | ||
"eslint-plugin-regexp": "1.15.0", | ||
@@ -92,3 +92,3 @@ "eslint-plugin-unicorn": "48.0.1", | ||
"markdown-it-sup": "1.0.0", | ||
"markdownlint-rule-helpers": "0.21.0", | ||
"markdownlint-rule-helpers": "0.22.0", | ||
"npm-run-all": "4.1.5", | ||
@@ -95,0 +95,0 @@ "strip-json-comments": "5.0.1", |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
731293