mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-09-22 05:40:48 +02:00
Update MD051/link-fragments to ignore HTML comments embedded in heading text.
This commit is contained in:
parent
6700accfd3
commit
1bd748f79e
5 changed files with 40 additions and 10 deletions
|
@ -16,7 +16,10 @@ const identifierRe = /(?:id|name)\s*=\s*['"]?([^'"\s>]+)/iu;
|
|||
* @returns {string} Fragment string for heading.
|
||||
*/
|
||||
function convertHeadingToHTMLFragment(inline) {
|
||||
const inlineText = inline.children.map((token) => token.content).join("");
|
||||
const inlineText = inline.children
|
||||
.filter((token) => token.type !== "html_inline")
|
||||
.map((token) => token.content)
|
||||
.join("");
|
||||
return "#" + encodeURIComponent(
|
||||
inlineText
|
||||
.toLowerCase()
|
||||
|
@ -77,7 +80,7 @@ module.exports = {
|
|||
context = match[0];
|
||||
range = [ match.index + 1, match[0].length ];
|
||||
}
|
||||
addError(onError, lineNumber, null, context, range);
|
||||
addError(onError, lineNumber, undefined, context, range);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue