mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-16 14:00:13 +01:00
Reimplement MD026/no-trailing-punctuation using micromark tokens, ignore trailing GitHub emoji codes, improve tests (fixes #457).
This commit is contained in:
parent
272c15ed39
commit
c06506c317
9 changed files with 157 additions and 32 deletions
25
test/headings-with-emoji.md
Normal file
25
test/headings-with-emoji.md
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
# headings-with-emoji
|
||||
|
||||
## Known Issues :bug:
|
||||
|
||||
## Love :heartpulse:
|
||||
|
||||
## :tada:
|
||||
|
||||
## :checkered_flag:
|
||||
|
||||
## :clock930:
|
||||
|
||||
## :t-rex:
|
||||
|
||||
## Boba:bubble_tea:
|
||||
|
||||
<!-- markdownlint-disable heading-style -->
|
||||
|
||||
## Fix the :bug: ##
|
||||
|
||||
Another :heartpulse:
|
||||
--------------------
|
||||
|
||||
:eyes:
|
||||
------
|
||||
|
|
@ -12,6 +12,8 @@
|
|||
|
||||
## Copyright 2004 ©
|
||||
|
||||
## Copyright 2004 ©
|
||||
|
||||
## Copyright 2005 ©
|
||||
|
||||
## Copyright 2006 © ##
|
||||
|
|
|
|||
|
|
@ -1283,3 +1283,21 @@ Empty bracket pairs: [text3[]][]
|
|||
};
|
||||
return markdownlint(options).then(() => null);
|
||||
});
|
||||
|
||||
test("endOfLineHtmlEntityRe", async(t) => {
|
||||
const { characterEntities } = await import("character-entities");
|
||||
const entities = Object.keys(characterEntities);
|
||||
t.plan(entities.length);
|
||||
for (const entity of entities) {
|
||||
t.true(helpers.endOfLineHtmlEntityRe.test(`-&${entity};`), entity);
|
||||
}
|
||||
});
|
||||
|
||||
test("endOfLineGemojiCodeRe", async(t) => {
|
||||
const { gemoji } = await import("gemoji");
|
||||
const emojis = gemoji.flatMap((i) => i.names);
|
||||
t.plan(emojis.length);
|
||||
for (const emoji of emojis) {
|
||||
t.true(helpers.endOfLineGemojiCodeRe.test(`-:${emoji}:`), emoji);
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -14772,6 +14772,40 @@ Generated by [AVA](https://avajs.dev).
|
|||
`,
|
||||
}
|
||||
|
||||
## headings-with-emoji.md
|
||||
|
||||
> Snapshot 1
|
||||
|
||||
{
|
||||
errors: [],
|
||||
fixed: `# headings-with-emoji␊
|
||||
␊
|
||||
## Known Issues :bug:␊
|
||||
␊
|
||||
## Love :heartpulse:␊
|
||||
␊
|
||||
## :tada:␊
|
||||
␊
|
||||
## :checkered_flag:␊
|
||||
␊
|
||||
## :clock930:␊
|
||||
␊
|
||||
## :t-rex:␊
|
||||
␊
|
||||
## Boba:bubble_tea:␊
|
||||
␊
|
||||
<!-- markdownlint-disable heading-style -->␊
|
||||
␊
|
||||
## Fix the :bug: ##␊
|
||||
␊
|
||||
Another :heartpulse:␊
|
||||
--------------------␊
|
||||
␊
|
||||
:eyes:␊
|
||||
------␊
|
||||
`,
|
||||
}
|
||||
|
||||
## headings-with-html-entities.md
|
||||
|
||||
> Snapshot 1
|
||||
|
|
@ -14789,7 +14823,7 @@ Generated by [AVA](https://avajs.dev).
|
|||
deleteCount: 1,
|
||||
editColumn: 31,
|
||||
},
|
||||
lineNumber: 22,
|
||||
lineNumber: 24,
|
||||
ruleDescription: 'Trailing punctuation in heading',
|
||||
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md026.md',
|
||||
ruleNames: [
|
||||
|
|
@ -14808,7 +14842,7 @@ Generated by [AVA](https://avajs.dev).
|
|||
deleteCount: 1,
|
||||
editColumn: 34,
|
||||
},
|
||||
lineNumber: 24,
|
||||
lineNumber: 26,
|
||||
ruleDescription: 'Trailing punctuation in heading',
|
||||
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md026.md',
|
||||
ruleNames: [
|
||||
|
|
@ -14827,7 +14861,7 @@ Generated by [AVA](https://avajs.dev).
|
|||
deleteCount: 1,
|
||||
editColumn: 31,
|
||||
},
|
||||
lineNumber: 26,
|
||||
lineNumber: 28,
|
||||
ruleDescription: 'Trailing punctuation in heading',
|
||||
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md026.md',
|
||||
ruleNames: [
|
||||
|
|
@ -14850,6 +14884,8 @@ Generated by [AVA](https://avajs.dev).
|
|||
␊
|
||||
## Copyright 2004 ©␊
|
||||
␊
|
||||
## Copyright 2004 ©␊
|
||||
␊
|
||||
## Copyright 2005 ©␊
|
||||
␊
|
||||
## Copyright 2006 © ##␊
|
||||
|
|
|
|||
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue