feat: stricter validation of heading fragments by being Case sensitive

Fixes #8

BREAKING CHANGE: Heading fragments is now Case sensitive.
For example "#ExistIng-Heading" is invalid as it should be "#existing-heading".
This commit is contained in:
2024-05-27 22:50:43 +02:00
parent 450cdb84f0
commit 85f465306f
6 changed files with 19 additions and 10 deletions

View File

@ -126,7 +126,7 @@ const customRule = {
fragmentsHTML.push(...idOrAnchorNameHTMLFragments)
if (!fragmentsHTML.includes(url.hash.toLowerCase())) {
if (!fragmentsHTML.includes(url.hash)) {
if (url.hash.startsWith("#L")) {
const lineNumberFragmentString = getLineNumberStringFromFragment(
url.hash,
@ -157,6 +157,8 @@ const customRule = {
})
continue
}
continue
}
onError({

View File

@ -28,7 +28,7 @@ const convertHeadingToHTMLFragment = (inlineText) => {
"",
)
.replace(/ /gu, "-"),
).toLowerCase()
)
)
}