Update MD051/link-fragments to include math text when creating heading fragments (fixes #1152).

This commit is contained in:
David Anson 2024-03-17 14:31:49 -07:00
parent 3acf7da822
commit fdd8ba1974
5 changed files with 56 additions and 40 deletions

View file

@ -6413,7 +6413,7 @@ const lineFragmentRe = /^#(?:L\d+(?:C\d+)?-L\d+(?:C\d+)?|L\d+)$/;
// Sets for filtering heading tokens during conversion // Sets for filtering heading tokens during conversion
const childrenExclude = new Set([ "image", "reference", "resource" ]); const childrenExclude = new Set([ "image", "reference", "resource" ]);
const tokensInclude = new Set( const tokensInclude = new Set(
[ "characterEscapeValue", "codeTextData", "data" ] [ "characterEscapeValue", "codeTextData", "data", "mathTextData" ]
); );
/** /**

View file

@ -16,7 +16,7 @@ const lineFragmentRe = /^#(?:L\d+(?:C\d+)?-L\d+(?:C\d+)?|L\d+)$/;
// Sets for filtering heading tokens during conversion // Sets for filtering heading tokens during conversion
const childrenExclude = new Set([ "image", "reference", "resource" ]); const childrenExclude = new Set([ "image", "reference", "resource" ]);
const tokensInclude = new Set( const tokensInclude = new Set(
[ "characterEscapeValue", "codeTextData", "data" ] [ "characterEscapeValue", "codeTextData", "data", "mathTextData" ]
); );
/** /**

View file

@ -88,6 +88,10 @@
[Valid](#l12-not-a-line-link) [Valid](#l12-not-a-line-link)
[Valid](#latex-style)
[Valid](#area-pi--r2)
[Valid](#L7) [Valid](#L7)
[Valid](#L30-L31) [Valid](#L30-L31)
@ -185,6 +189,10 @@ Text
### L12 Not A Line Link ### L12 Not A Line Link
## $\LaTeX$ Style
## Area: $\pi * r^2$
<a name="namedlink"></a> <a name="namedlink"></a>
<a id = idlink></a> <a id = idlink></a>

View file

@ -23905,7 +23905,7 @@ Generated by [AVA](https://avajs.dev).
37, 37,
], ],
fixInfo: null, fixInfo: null,
lineNumber: 210, lineNumber: 218,
ruleDescription: 'Link fragments should be valid', ruleDescription: 'Link fragments should be valid',
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md051.md', ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md051.md',
ruleNames: [ ruleNames: [
@ -23921,7 +23921,7 @@ Generated by [AVA](https://avajs.dev).
31, 31,
], ],
fixInfo: null, fixInfo: null,
lineNumber: 212, lineNumber: 220,
ruleDescription: 'Link fragments should be valid', ruleDescription: 'Link fragments should be valid',
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md051.md', ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md051.md',
ruleNames: [ ruleNames: [
@ -23937,7 +23937,7 @@ Generated by [AVA](https://avajs.dev).
36, 36,
], ],
fixInfo: null, fixInfo: null,
lineNumber: 214, lineNumber: 222,
ruleDescription: 'Link fragments should be valid', ruleDescription: 'Link fragments should be valid',
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md051.md', ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md051.md',
ruleNames: [ ruleNames: [
@ -23953,7 +23953,7 @@ Generated by [AVA](https://avajs.dev).
28, 28,
], ],
fixInfo: null, fixInfo: null,
lineNumber: 216, lineNumber: 224,
ruleDescription: 'Link fragments should be valid', ruleDescription: 'Link fragments should be valid',
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md051.md', ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md051.md',
ruleNames: [ ruleNames: [
@ -23969,7 +23969,7 @@ Generated by [AVA](https://avajs.dev).
18, 18,
], ],
fixInfo: null, fixInfo: null,
lineNumber: 218, lineNumber: 226,
ruleDescription: 'Link fragments should be valid', ruleDescription: 'Link fragments should be valid',
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md051.md', ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md051.md',
ruleNames: [ ruleNames: [
@ -23989,7 +23989,7 @@ Generated by [AVA](https://avajs.dev).
editColumn: 11, editColumn: 11,
insertText: '#HREFandID', insertText: '#HREFandID',
}, },
lineNumber: 220, lineNumber: 228,
ruleDescription: 'Link fragments should be valid', ruleDescription: 'Link fragments should be valid',
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md051.md', ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md051.md',
ruleNames: [ ruleNames: [
@ -24005,7 +24005,7 @@ Generated by [AVA](https://avajs.dev).
34, 34,
], ],
fixInfo: null, fixInfo: null,
lineNumber: 222, lineNumber: 230,
ruleDescription: 'Link fragments should be valid', ruleDescription: 'Link fragments should be valid',
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md051.md', ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md051.md',
ruleNames: [ ruleNames: [
@ -24021,7 +24021,7 @@ Generated by [AVA](https://avajs.dev).
34, 34,
], ],
fixInfo: null, fixInfo: null,
lineNumber: 224, lineNumber: 232,
ruleDescription: 'Link fragments should be valid', ruleDescription: 'Link fragments should be valid',
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md051.md', ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md051.md',
ruleNames: [ ruleNames: [
@ -24037,7 +24037,7 @@ Generated by [AVA](https://avajs.dev).
39, 39,
], ],
fixInfo: null, fixInfo: null,
lineNumber: 226, lineNumber: 234,
ruleDescription: 'Link fragments should be valid', ruleDescription: 'Link fragments should be valid',
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md051.md', ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md051.md',
ruleNames: [ ruleNames: [
@ -24050,7 +24050,7 @@ Generated by [AVA](https://avajs.dev).
errorDetail: null, errorDetail: null,
errorRange: null, errorRange: null,
fixInfo: null, fixInfo: null,
lineNumber: 228, lineNumber: 236,
ruleDescription: 'Link fragments should be valid', ruleDescription: 'Link fragments should be valid',
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md051.md', ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md051.md',
ruleNames: [ ruleNames: [
@ -24066,7 +24066,7 @@ Generated by [AVA](https://avajs.dev).
28, 28,
], ],
fixInfo: null, fixInfo: null,
lineNumber: 233, lineNumber: 241,
ruleDescription: 'Link fragments should be valid', ruleDescription: 'Link fragments should be valid',
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md051.md', ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md051.md',
ruleNames: [ ruleNames: [
@ -24086,7 +24086,7 @@ Generated by [AVA](https://avajs.dev).
editColumn: 9, editColumn: 9,
insertText: '#valid-fragments', insertText: '#valid-fragments',
}, },
lineNumber: 237, lineNumber: 245,
ruleDescription: 'Link fragments should be valid', ruleDescription: 'Link fragments should be valid',
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md051.md', ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md051.md',
ruleNames: [ ruleNames: [
@ -24106,7 +24106,7 @@ Generated by [AVA](https://avajs.dev).
editColumn: 12, editColumn: 12,
insertText: '#namedlink', insertText: '#namedlink',
}, },
lineNumber: 239, lineNumber: 247,
ruleDescription: 'Link fragments should be valid', ruleDescription: 'Link fragments should be valid',
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md051.md', ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md051.md',
ruleNames: [ ruleNames: [
@ -24119,7 +24119,7 @@ Generated by [AVA](https://avajs.dev).
errorDetail: 'Expected: #namedlink; Actual: #NAMEDLINK', errorDetail: 'Expected: #namedlink; Actual: #NAMEDLINK',
errorRange: null, errorRange: null,
fixInfo: null, fixInfo: null,
lineNumber: 241, lineNumber: 249,
ruleDescription: 'Link fragments should be valid', ruleDescription: 'Link fragments should be valid',
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md051.md', ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md051.md',
ruleNames: [ ruleNames: [
@ -24139,7 +24139,7 @@ Generated by [AVA](https://avajs.dev).
editColumn: 13, editColumn: 13,
insertText: '#idlink', insertText: '#idlink',
}, },
lineNumber: 246, lineNumber: 254,
ruleDescription: 'Link fragments should be valid', ruleDescription: 'Link fragments should be valid',
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md051.md', ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md051.md',
ruleNames: [ ruleNames: [
@ -24155,7 +24155,7 @@ Generated by [AVA](https://avajs.dev).
26, 26,
], ],
fixInfo: null, fixInfo: null,
lineNumber: 281, lineNumber: 289,
ruleDescription: 'Link fragments should be valid', ruleDescription: 'Link fragments should be valid',
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md051.md', ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md051.md',
ruleNames: [ ruleNames: [
@ -24171,7 +24171,7 @@ Generated by [AVA](https://avajs.dev).
26, 26,
], ],
fixInfo: null, fixInfo: null,
lineNumber: 283, lineNumber: 291,
ruleDescription: 'Link fragments should be valid', ruleDescription: 'Link fragments should be valid',
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md051.md', ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md051.md',
ruleNames: [ ruleNames: [
@ -24187,7 +24187,7 @@ Generated by [AVA](https://avajs.dev).
20, 20,
], ],
fixInfo: null, fixInfo: null,
lineNumber: 285, lineNumber: 293,
ruleDescription: 'Link fragments should be valid', ruleDescription: 'Link fragments should be valid',
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md051.md', ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md051.md',
ruleNames: [ ruleNames: [
@ -24203,7 +24203,7 @@ Generated by [AVA](https://avajs.dev).
23, 23,
], ],
fixInfo: null, fixInfo: null,
lineNumber: 287, lineNumber: 295,
ruleDescription: 'Link fragments should be valid', ruleDescription: 'Link fragments should be valid',
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md051.md', ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md051.md',
ruleNames: [ ruleNames: [
@ -24219,7 +24219,7 @@ Generated by [AVA](https://avajs.dev).
22, 22,
], ],
fixInfo: null, fixInfo: null,
lineNumber: 289, lineNumber: 297,
ruleDescription: 'Link fragments should be valid', ruleDescription: 'Link fragments should be valid',
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md051.md', ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md051.md',
ruleNames: [ ruleNames: [
@ -24235,7 +24235,7 @@ Generated by [AVA](https://avajs.dev).
42, 42,
], ],
fixInfo: null, fixInfo: null,
lineNumber: 291, lineNumber: 299,
ruleDescription: 'Link fragments should be valid', ruleDescription: 'Link fragments should be valid',
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md051.md', ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md051.md',
ruleNames: [ ruleNames: [
@ -24251,7 +24251,7 @@ Generated by [AVA](https://avajs.dev).
21, 21,
], ],
fixInfo: null, fixInfo: null,
lineNumber: 293, lineNumber: 301,
ruleDescription: 'Link fragments should be valid', ruleDescription: 'Link fragments should be valid',
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md051.md', ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md051.md',
ruleNames: [ ruleNames: [
@ -24267,7 +24267,7 @@ Generated by [AVA](https://avajs.dev).
21, 21,
], ],
fixInfo: null, fixInfo: null,
lineNumber: 295, lineNumber: 303,
ruleDescription: 'Link fragments should be valid', ruleDescription: 'Link fragments should be valid',
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md051.md', ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md051.md',
ruleNames: [ ruleNames: [
@ -24287,7 +24287,7 @@ Generated by [AVA](https://avajs.dev).
editColumn: 11, editColumn: 11,
insertText: '#l12-not-a-line-link', insertText: '#l12-not-a-line-link',
}, },
lineNumber: 297, lineNumber: 305,
ruleDescription: 'Link fragments should be valid', ruleDescription: 'Link fragments should be valid',
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md051.md', ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md051.md',
ruleNames: [ ruleNames: [
@ -24303,7 +24303,7 @@ Generated by [AVA](https://avajs.dev).
14, 14,
], ],
fixInfo: null, fixInfo: null,
lineNumber: 299, lineNumber: 307,
ruleDescription: 'Link fragments should be valid', ruleDescription: 'Link fragments should be valid',
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md051.md', ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md051.md',
ruleNames: [ ruleNames: [
@ -24319,7 +24319,7 @@ Generated by [AVA](https://avajs.dev).
13, 13,
], ],
fixInfo: null, fixInfo: null,
lineNumber: 301, lineNumber: 309,
ruleDescription: 'Link fragments should be valid', ruleDescription: 'Link fragments should be valid',
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md051.md', ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md051.md',
ruleNames: [ ruleNames: [
@ -24335,7 +24335,7 @@ Generated by [AVA](https://avajs.dev).
19, 19,
], ],
fixInfo: null, fixInfo: null,
lineNumber: 303, lineNumber: 311,
ruleDescription: 'Link fragments should be valid', ruleDescription: 'Link fragments should be valid',
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md051.md', ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md051.md',
ruleNames: [ ruleNames: [
@ -24351,7 +24351,7 @@ Generated by [AVA](https://avajs.dev).
16, 16,
], ],
fixInfo: null, fixInfo: null,
lineNumber: 305, lineNumber: 313,
ruleDescription: 'Link fragments should be valid', ruleDescription: 'Link fragments should be valid',
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md051.md', ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md051.md',
ruleNames: [ ruleNames: [
@ -24367,7 +24367,7 @@ Generated by [AVA](https://avajs.dev).
21, 21,
], ],
fixInfo: null, fixInfo: null,
lineNumber: 307, lineNumber: 315,
ruleDescription: 'Link fragments should be valid', ruleDescription: 'Link fragments should be valid',
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md051.md', ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md051.md',
ruleNames: [ ruleNames: [
@ -24383,7 +24383,7 @@ Generated by [AVA](https://avajs.dev).
18, 18,
], ],
fixInfo: null, fixInfo: null,
lineNumber: 309, lineNumber: 317,
ruleDescription: 'Link fragments should be valid', ruleDescription: 'Link fragments should be valid',
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md051.md', ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md051.md',
ruleNames: [ ruleNames: [
@ -24399,7 +24399,7 @@ Generated by [AVA](https://avajs.dev).
18, 18,
], ],
fixInfo: null, fixInfo: null,
lineNumber: 311, lineNumber: 319,
ruleDescription: 'Link fragments should be valid', ruleDescription: 'Link fragments should be valid',
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md051.md', ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md051.md',
ruleNames: [ ruleNames: [
@ -24415,7 +24415,7 @@ Generated by [AVA](https://avajs.dev).
19, 19,
], ],
fixInfo: null, fixInfo: null,
lineNumber: 313, lineNumber: 321,
ruleDescription: 'Link fragments should be valid', ruleDescription: 'Link fragments should be valid',
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md051.md', ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md051.md',
ruleNames: [ ruleNames: [
@ -24431,7 +24431,7 @@ Generated by [AVA](https://avajs.dev).
20, 20,
], ],
fixInfo: null, fixInfo: null,
lineNumber: 315, lineNumber: 323,
ruleDescription: 'Link fragments should be valid', ruleDescription: 'Link fragments should be valid',
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md051.md', ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md051.md',
ruleNames: [ ruleNames: [
@ -24447,7 +24447,7 @@ Generated by [AVA](https://avajs.dev).
23, 23,
], ],
fixInfo: null, fixInfo: null,
lineNumber: 317, lineNumber: 325,
ruleDescription: 'Link fragments should be valid', ruleDescription: 'Link fragments should be valid',
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md051.md', ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md051.md',
ruleNames: [ ruleNames: [
@ -24463,7 +24463,7 @@ Generated by [AVA](https://avajs.dev).
22, 22,
], ],
fixInfo: null, fixInfo: null,
lineNumber: 319, lineNumber: 327,
ruleDescription: 'Link fragments should be valid', ruleDescription: 'Link fragments should be valid',
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md051.md', ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md051.md',
ruleNames: [ ruleNames: [
@ -24479,7 +24479,7 @@ Generated by [AVA](https://avajs.dev).
15, 15,
], ],
fixInfo: null, fixInfo: null,
lineNumber: 321, lineNumber: 329,
ruleDescription: 'Link fragments should be valid', ruleDescription: 'Link fragments should be valid',
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md051.md', ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md051.md',
ruleNames: [ ruleNames: [
@ -24495,7 +24495,7 @@ Generated by [AVA](https://avajs.dev).
19, 19,
], ],
fixInfo: null, fixInfo: null,
lineNumber: 323, lineNumber: 331,
ruleDescription: 'Link fragments should be valid', ruleDescription: 'Link fragments should be valid',
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md051.md', ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md051.md',
ruleNames: [ ruleNames: [
@ -24511,7 +24511,7 @@ Generated by [AVA](https://avajs.dev).
21, 21,
], ],
fixInfo: null, fixInfo: null,
lineNumber: 325, lineNumber: 333,
ruleDescription: 'Link fragments should be valid', ruleDescription: 'Link fragments should be valid',
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md051.md', ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md051.md',
ruleNames: [ ruleNames: [
@ -24610,6 +24610,10 @@ Generated by [AVA](https://avajs.dev).
[Valid](#l12-not-a-line-link)␊ [Valid](#l12-not-a-line-link)␊
[Valid](#latex-style)␊
[Valid](#area-pi--r2)␊
[Valid](#L7)␊ [Valid](#L7)␊
[Valid](#L30-L31)␊ [Valid](#L30-L31)␊
@ -24707,6 +24711,10 @@ Generated by [AVA](https://avajs.dev).
### L12 Not A Line Link␊ ### L12 Not A Line Link␊
## $\\LaTeX$ Style␊
## Area: $\\pi * r^2$␊
<a name="namedlink"></a> <a name="namedlink"></a>
<a id = idlink></a> <a id = idlink></a>