Update MD051/link-fragments to handle backslash-escaping in heading text (fixes #984).

This commit is contained in:
David Anson 2023-09-18 22:20:44 -07:00
parent ca9930464e
commit 941769f204
5 changed files with 35 additions and 25 deletions

View file

@ -6229,7 +6229,7 @@ var anchorRe = /\{(#[0-9a-z]+(?:[\x2D_][0-9a-z]+)*)\}/g;
// Sets for filtering heading tokens during conversion
var childrenExclude = new Set(["image", "reference", "resource"]);
var tokensInclude = new Set(["codeTextData", "data"]);
var tokensInclude = new Set(["characterEscapeValue", "codeTextData", "data"]);
/**
* @typedef {import("../helpers/micromark.cjs").Token} Token

View file

@ -13,7 +13,9 @@ const anchorRe = /\{(#[a-z\d]+(?:[-_][a-z\d]+)*)\}/gu;
// Sets for filtering heading tokens during conversion
const childrenExclude = new Set([ "image", "reference", "resource" ]);
const tokensInclude = new Set([ "codeTextData", "data" ]);
const tokensInclude = new Set(
[ "characterEscapeValue", "codeTextData", "data" ]
);
/**
* @typedef {import("../helpers/micromark.cjs").Token} Token

View file

@ -68,6 +68,8 @@
[Valid](#valid\_heading\-escaped\_underscores)
[Valid](#valid-heading-with_embedded_escaping)
[Valid](#namedlink)
[Valid](#idlink)
@ -167,6 +169,8 @@ Text
### Valid_Heading Escaped_Underscores
### Valid Heading\-With\_Embedded\_Escaping
<a name="namedlink"></a>
<a id = idlink></a>

View file

@ -23989,7 +23989,7 @@ Generated by [AVA](https://avajs.dev).
37,
],
fixInfo: null,
lineNumber: 192,
lineNumber: 196,
ruleDescription: 'Link fragments should be valid',
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md051.md',
ruleNames: [
@ -24005,7 +24005,7 @@ Generated by [AVA](https://avajs.dev).
31,
],
fixInfo: null,
lineNumber: 194,
lineNumber: 198,
ruleDescription: 'Link fragments should be valid',
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md051.md',
ruleNames: [
@ -24021,7 +24021,7 @@ Generated by [AVA](https://avajs.dev).
36,
],
fixInfo: null,
lineNumber: 196,
lineNumber: 200,
ruleDescription: 'Link fragments should be valid',
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md051.md',
ruleNames: [
@ -24037,7 +24037,7 @@ Generated by [AVA](https://avajs.dev).
28,
],
fixInfo: null,
lineNumber: 198,
lineNumber: 202,
ruleDescription: 'Link fragments should be valid',
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md051.md',
ruleNames: [
@ -24053,7 +24053,7 @@ Generated by [AVA](https://avajs.dev).
18,
],
fixInfo: null,
lineNumber: 200,
lineNumber: 204,
ruleDescription: 'Link fragments should be valid',
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md051.md',
ruleNames: [
@ -24073,7 +24073,7 @@ Generated by [AVA](https://avajs.dev).
editColumn: 11,
insertText: '#HREFandID',
},
lineNumber: 202,
lineNumber: 206,
ruleDescription: 'Link fragments should be valid',
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md051.md',
ruleNames: [
@ -24089,7 +24089,7 @@ Generated by [AVA](https://avajs.dev).
34,
],
fixInfo: null,
lineNumber: 204,
lineNumber: 208,
ruleDescription: 'Link fragments should be valid',
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md051.md',
ruleNames: [
@ -24105,7 +24105,7 @@ Generated by [AVA](https://avajs.dev).
34,
],
fixInfo: null,
lineNumber: 206,
lineNumber: 210,
ruleDescription: 'Link fragments should be valid',
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md051.md',
ruleNames: [
@ -24121,7 +24121,7 @@ Generated by [AVA](https://avajs.dev).
39,
],
fixInfo: null,
lineNumber: 208,
lineNumber: 212,
ruleDescription: 'Link fragments should be valid',
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md051.md',
ruleNames: [
@ -24134,7 +24134,7 @@ Generated by [AVA](https://avajs.dev).
errorDetail: null,
errorRange: null,
fixInfo: null,
lineNumber: 210,
lineNumber: 214,
ruleDescription: 'Link fragments should be valid',
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md051.md',
ruleNames: [
@ -24150,7 +24150,7 @@ Generated by [AVA](https://avajs.dev).
28,
],
fixInfo: null,
lineNumber: 215,
lineNumber: 219,
ruleDescription: 'Link fragments should be valid',
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md051.md',
ruleNames: [
@ -24170,7 +24170,7 @@ Generated by [AVA](https://avajs.dev).
editColumn: 9,
insertText: '#valid-fragments',
},
lineNumber: 219,
lineNumber: 223,
ruleDescription: 'Link fragments should be valid',
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md051.md',
ruleNames: [
@ -24190,7 +24190,7 @@ Generated by [AVA](https://avajs.dev).
editColumn: 12,
insertText: '#namedlink',
},
lineNumber: 221,
lineNumber: 225,
ruleDescription: 'Link fragments should be valid',
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md051.md',
ruleNames: [
@ -24203,7 +24203,7 @@ Generated by [AVA](https://avajs.dev).
errorDetail: 'Expected: #namedlink; Actual: #NAMEDLINK',
errorRange: null,
fixInfo: null,
lineNumber: 223,
lineNumber: 227,
ruleDescription: 'Link fragments should be valid',
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md051.md',
ruleNames: [
@ -24223,7 +24223,7 @@ Generated by [AVA](https://avajs.dev).
editColumn: 13,
insertText: '#idlink',
},
lineNumber: 228,
lineNumber: 232,
ruleDescription: 'Link fragments should be valid',
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md051.md',
ruleNames: [
@ -24239,7 +24239,7 @@ Generated by [AVA](https://avajs.dev).
26,
],
fixInfo: null,
lineNumber: 263,
lineNumber: 267,
ruleDescription: 'Link fragments should be valid',
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md051.md',
ruleNames: [
@ -24255,7 +24255,7 @@ Generated by [AVA](https://avajs.dev).
26,
],
fixInfo: null,
lineNumber: 265,
lineNumber: 269,
ruleDescription: 'Link fragments should be valid',
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md051.md',
ruleNames: [
@ -24271,7 +24271,7 @@ Generated by [AVA](https://avajs.dev).
20,
],
fixInfo: null,
lineNumber: 267,
lineNumber: 271,
ruleDescription: 'Link fragments should be valid',
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md051.md',
ruleNames: [
@ -24287,7 +24287,7 @@ Generated by [AVA](https://avajs.dev).
23,
],
fixInfo: null,
lineNumber: 269,
lineNumber: 273,
ruleDescription: 'Link fragments should be valid',
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md051.md',
ruleNames: [
@ -24303,7 +24303,7 @@ Generated by [AVA](https://avajs.dev).
22,
],
fixInfo: null,
lineNumber: 271,
lineNumber: 275,
ruleDescription: 'Link fragments should be valid',
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md051.md',
ruleNames: [
@ -24319,7 +24319,7 @@ Generated by [AVA](https://avajs.dev).
42,
],
fixInfo: null,
lineNumber: 273,
lineNumber: 277,
ruleDescription: 'Link fragments should be valid',
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md051.md',
ruleNames: [
@ -24335,7 +24335,7 @@ Generated by [AVA](https://avajs.dev).
21,
],
fixInfo: null,
lineNumber: 275,
lineNumber: 279,
ruleDescription: 'Link fragments should be valid',
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md051.md',
ruleNames: [
@ -24351,7 +24351,7 @@ Generated by [AVA](https://avajs.dev).
21,
],
fixInfo: null,
lineNumber: 277,
lineNumber: 281,
ruleDescription: 'Link fragments should be valid',
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md051.md',
ruleNames: [
@ -24430,6 +24430,8 @@ Generated by [AVA](https://avajs.dev).
[Valid](#valid\\_heading\\-escaped\\_underscores)␊
[Valid](#valid-heading-with_embedded_escaping)␊
[Valid](#namedlink)␊
[Valid](#idlink)␊
@ -24529,6 +24531,8 @@ Generated by [AVA](https://avajs.dev).
### Valid_Heading Escaped_Underscores␊
### Valid Heading\\-With\\_Embedded\\_Escaping␊
<a name="namedlink"></a>
<a id = idlink></a>