Reimplement MD038/no-space-in-code using micromark tokens.

This commit is contained in:
David Anson 2023-02-23 22:20:27 -08:00
parent b787758a48
commit 962547ecc8
6 changed files with 219 additions and 93 deletions

View file

@ -160,6 +160,7 @@ test("https://github.com/dotnet/docs", (t) => {
/^test-repos\/dotnet-docs\/docs\/framework\/whats-new\/index\.md: \d+: MD034\/.*$\r?\n?/gm,
/^test-repos\/dotnet-docs\/docs\/orleans\/tutorials-and-samples\/index\.md: \d+: MD034\/.*$\r?\n?/gm,
/^test-repos\/dotnet-docs\/docs\/standard\/base-types\/regular-expression-source-generators\.md: \d+: MD034\/.*$\r?\n?/gm,
/^test-repos\/dotnet-docs\/docs\/standard\/generics\/math\.md: \d+: MD038\/.*$\r?\n?/gm,
/^test-repos\/dotnet-docs\/docs\/standard\/serialization\/xml-schema-def-tool-gen\.md: \d+: MD034\/.*$\r?\n?/gm
];
return lintTestRepo(t, globPatterns, configPath, ignoreRes);

View file

@ -38877,6 +38877,46 @@ Generated by [AVA](https://avajs.dev).
'no-space-in-code',
],
},
{
errorContext: '``` ` multiple leading {MD038...',
errorDetail: null,
errorRange: [
6,
31,
],
fixInfo: {
deleteCount: 28,
editColumn: 9,
insertText: ' ` multiple leading {MD038}',
},
lineNumber: 129,
ruleDescription: 'Spaces inside code span elements',
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md038.md',
ruleNames: [
'MD038',
'no-space-in-code',
],
},
{
errorContext: 'not allowed ` ``',
errorDetail: null,
errorRange: [
1,
17,
],
fixInfo: {
deleteCount: 15,
editColumn: 1,
insertText: 'not allowed ` ',
},
lineNumber: 136,
ruleDescription: 'Spaces inside code span elements',
ruleInformation: 'https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md038.md',
ruleNames: [
'MD038',
'no-space-in-code',
],
},
{
errorContext: '#link%60link',
errorDetail: null,
@ -39080,6 +39120,21 @@ Generated by [AVA](https://avajs.dev).
Again, 2 characters: \` ab \`␊
Again, 1 character: \` a \`␊
Many internal spaces: \` code code code code code code \`␊
text \`\`\` \` leading space␊
allowed for backtick\`\`\` text␊
text \`\`\` \` multiple leading {MD038}␊
spaces not allowed\`\`\` text␊
text \`\`trailing space␊
allowed for backtick \` \`\` text␊
text \`\`multiple trailing spaces␊
not allowed \` \`\` text {MD038}␊
text \`\` \` leading and trailing␊
space allowed for backtick \` \`\` text␊
`,
}

View file

@ -122,3 +122,18 @@ Again, 3 characters: ` abc `
Again, 2 characters: ` ab `
Again, 1 character: ` a `
Many internal spaces: ` code code code code code code `
text ``` ` leading space
allowed for backtick``` text
text ``` ` multiple leading {MD038}
spaces not allowed``` text
text ``trailing space
allowed for backtick ` `` text
text ``multiple trailing spaces
not allowed ` `` text {MD038}
text `` ` leading and trailing
space allowed for backtick ` `` text