mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2026-01-08 08:58:50 +01:00
Update MD031/blanks-around-fences and MD032/blanks-around-lists to ignore comments and blockquotes (fixes #171, fixes #172).
This commit is contained in:
parent
df2507f030
commit
1db87ef0c6
5 changed files with 120 additions and 16 deletions
61
test/blanks-around.md
Normal file
61
test/blanks-around.md
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
# Blanks Around
|
||||
|
||||
---
|
||||
|
||||
## MD022/blanks-around-headings
|
||||
|
||||
>
|
||||
### Alpha {MD022}
|
||||
> >
|
||||
|
||||
<!-- comment -->
|
||||
### Beta {MD022}
|
||||
<!-- comments --><!-- comments -->
|
||||
|
||||
> Text
|
||||
>
|
||||
> ### Gamma
|
||||
> >
|
||||
> > Text
|
||||
|
||||
---
|
||||
|
||||
## MD031/blanks-around-fences
|
||||
|
||||
> >
|
||||
```js
|
||||
console.log();
|
||||
```
|
||||
>
|
||||
|
||||
<!-- prettier-ignore -->
|
||||
```js
|
||||
console.log();
|
||||
```
|
||||
<!-- prettier-ignore -->
|
||||
|
||||
> Text
|
||||
>
|
||||
> ```js
|
||||
> console.log();
|
||||
> ```
|
||||
> >
|
||||
> >Text
|
||||
|
||||
---
|
||||
|
||||
## MD032/blanks-around-lists
|
||||
|
||||
>
|
||||
- List item
|
||||
>>
|
||||
|
||||
<!--comments--><!-- comments -->
|
||||
- List item
|
||||
<!--comment-->
|
||||
|
||||
> Text
|
||||
>
|
||||
> - List item
|
||||
>>
|
||||
>> Text
|
||||
|
|
@ -1396,6 +1396,42 @@ function clearHtmlCommentTextEmbedded(test) {
|
|||
test.done();
|
||||
};
|
||||
|
||||
module.exports.isBlankLine = function isBlankLine(test) {
|
||||
test.expect(25);
|
||||
const blankLines = [
|
||||
null,
|
||||
"",
|
||||
" ",
|
||||
" ",
|
||||
"\t\t\t",
|
||||
"\r",
|
||||
"\n",
|
||||
"\t\r\n",
|
||||
" <!-- text --> ",
|
||||
"<!--text-->",
|
||||
"<!---->",
|
||||
"<!-- text -->\t<!-- text -->",
|
||||
">",
|
||||
"> ",
|
||||
"> > > \t",
|
||||
"> <!--text-->",
|
||||
">><!--text-->"
|
||||
];
|
||||
blankLines.forEach((line) => test.ok(shared.isBlankLine(line), line));
|
||||
const nonBlankLines = [
|
||||
"text",
|
||||
" text ",
|
||||
".",
|
||||
"> .",
|
||||
"<!--text--> text",
|
||||
"<!--->",
|
||||
"<!--",
|
||||
"-->"
|
||||
];
|
||||
nonBlankLines.forEach((line) => test.ok(!shared.isBlankLine(line), line));
|
||||
test.done();
|
||||
};
|
||||
|
||||
module.exports.trimLeftRight = function trimLeftRight(test) {
|
||||
const inputs = [
|
||||
"text text",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue