feat: html anchor support

This commit is contained in:
Igor Tsiglyar
2024-01-11 13:42:34 +00:00
committed by Théo LUDWIG
parent 9d2cc818d5
commit 24a0788d32
11 changed files with 123 additions and 11 deletions

View File

@ -65,16 +65,22 @@ test("ensure the rule validates correctly", async (t) => {
const lintResults = await validateMarkdownLint(
"test/fixtures/invalid/non-existing-heading-fragment/non-existing-heading-fragment.md",
)
assert.equal(lintResults?.length, 1)
assert.deepEqual(lintResults?.[0]?.ruleNames, relativeLinksRule.names)
assert.equal(
lintResults?.[0]?.ruleDescription,
relativeLinksRule.description,
)
assert.equal(lintResults?.length, 2)
for (let i = 0; i < 2; i++) {
assert.deepEqual(lintResults?.[i]?.ruleNames, relativeLinksRule.names)
assert.equal(
lintResults?.[i]?.ruleDescription,
relativeLinksRule.description,
)
}
assert.equal(
lintResults?.[0]?.errorDetail,
'"./awesome.md#non-existing-heading" should have a valid fragment identifier',
)
assert.equal(
lintResults?.[1]?.errorDetail,
'"./awesome.md#non-existing-heading-anchor" should have a valid fragment identifier',
)
})
await t.test("with a non-existing file", async () => {