Reimplement getReferenceLinkImageData using micromark tokens.

This commit is contained in:
David Anson 2023-01-29 20:36:53 -08:00
parent 57c612cfa4
commit 97f99befb8
13 changed files with 1235 additions and 1068 deletions

View file

@ -32971,26 +32971,7 @@ Generated by [AVA](https://avajs.dev).
> Snapshot 1
{
errors: [
{
errorContext: '[Another2]: https://www.exampl...',
errorDetail: 'Unused link or image reference definition: "another2"',
errorRange: [
1,
56,
],
fixInfo: {
deleteCount: -1,
},
lineNumber: 36,
ruleDescription: 'Link and image reference definitions should be needed',
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md053.md',
ruleNames: [
'MD053',
'link-image-reference-definitions',
],
},
],
errors: [],
fixed: `# Pandoc Footnotes␊
> Examples taken from [GitHub issue 599](https://github.com/DavidAnson/markdownlint/issues/599)␊
@ -33026,6 +33007,7 @@ Generated by [AVA](https://avajs.dev).
[PCW2]: https://www.example.com/article.html␊
[Pandoc2]: https://pandoc.org/MANUAL.html#extension-footnotes␊
[Another2]: https://www.example.com/another.html␊
## GitHub Footnotes␊
@ -35306,7 +35288,7 @@ Generated by [AVA](https://avajs.dev).
25,
],
fixInfo: null,
lineNumber: 216,
lineNumber: 217,
ruleDescription: 'Reference links and images should use a label that is defined',
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md052.md',
ruleNames: [
@ -35322,7 +35304,7 @@ Generated by [AVA](https://avajs.dev).
10,
],
fixInfo: null,
lineNumber: 230,
lineNumber: 231,
ruleDescription: 'Reference links and images should use a label that is defined',
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md052.md',
ruleNames: [
@ -35340,7 +35322,7 @@ Generated by [AVA](https://avajs.dev).
fixInfo: {
deleteCount: -1,
},
lineNumber: 192,
lineNumber: 193,
ruleDescription: 'Link and image reference definitions should be needed',
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md053.md',
ruleNames: [
@ -35376,7 +35358,7 @@ Generated by [AVA](https://avajs.dev).
fixInfo: {
deleteCount: -1,
},
lineNumber: 198,
lineNumber: 197,
ruleDescription: 'Link and image reference definitions should be needed',
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md053.md',
ruleNames: [
@ -35392,7 +35374,7 @@ Generated by [AVA](https://avajs.dev).
44,
],
fixInfo: null,
lineNumber: 200,
lineNumber: 201,
ruleDescription: 'Link and image reference definitions should be needed',
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md053.md',
ruleNames: [
@ -35408,7 +35390,7 @@ Generated by [AVA](https://avajs.dev).
44,
],
fixInfo: null,
lineNumber: 203,
lineNumber: 204,
ruleDescription: 'Link and image reference definitions should be needed',
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md053.md',
ruleNames: [
@ -35574,7 +35556,6 @@ Generated by [AVA](https://avajs.dev).
[image7]: https://example.com/image7␊
[image8]: https://example.com/image8␊
[\`code\`]: https://example.com/code␊
[^1]: https://example.com/footnote␊
[multi line full text]: https://example.com/multi-line-full-text␊
[multi line full label]: https://example.com/multi-line-full-label␊
[multi line collapsed label]: https://example.com/multi-line-collapsed-label␊
@ -35598,6 +35579,7 @@ Generated by [AVA](https://avajs.dev).
[unique8]: https://example.com/unique8␊
[unique9]: https://example.com/unique9␊
[unique10]: https://example.com/unique10␊
[^1]: https://example.com/footnote␊
## Ignored Labels␊
@ -35607,11 +35589,12 @@ Generated by [AVA](https://avajs.dev).
## Invalid Labels␊
Duplicate:␊
Duplicate/unused:␊
Unused:␊
[blank-line-filler-0]: https://example.com␊
[blank-line-filler-1]: https://example.com␊
Unused footnote:
[blank-line-filler-0][] [blank-line-filler-1][]
[Duplicate unused multi-line label {MD053}]:␊
https://example.com/duplicate-unused-multi-line-label␊