mirror of
https://github.com/theoludwig/markdownlint-rule-relative-links.git
synced 2025-05-27 11:37:24 +02:00
feat: html anchor support
This commit is contained in:
@ -4,6 +4,7 @@ const assert = require("node:assert/strict")
|
||||
const {
|
||||
convertHeadingToHTMLFragment,
|
||||
getMarkdownHeadings,
|
||||
getMarkdownAnchorHTMLFragments,
|
||||
} = require("../src/utils.js")
|
||||
|
||||
test("utils", async (t) => {
|
||||
@ -34,4 +35,17 @@ test("utils", async (t) => {
|
||||
["Hello", "World", "Hello, world!"],
|
||||
)
|
||||
})
|
||||
|
||||
await t.test("getMarkdownAnchorHTMLFragments", async () => {
|
||||
assert.deepStrictEqual(
|
||||
getMarkdownAnchorHTMLFragments('<a name="anchorName" id="anchorId"></a>'),
|
||||
["#anchorId"],
|
||||
)
|
||||
assert.deepStrictEqual(
|
||||
getMarkdownAnchorHTMLFragments('<a name="anchorName"></a>'),
|
||||
["#anchorName"],
|
||||
)
|
||||
assert.deepStrictEqual(getMarkdownAnchorHTMLFragments("<a></a>"), [])
|
||||
assert.deepStrictEqual(getMarkdownAnchorHTMLFragments("<a>"), [])
|
||||
})
|
||||
})
|
||||
|
Reference in New Issue
Block a user