Update previous commit for MD051/link-fragments to rename, refactor, add support for HTML anchors, and validate against

markdown-link-check (fixes #253).
This commit is contained in:
David Anson 2022-04-10 05:37:57 +00:00
parent 33ee1cd85e
commit db5d9f6dbb
21 changed files with 355 additions and 181 deletions

View file

@ -18,6 +18,9 @@ const inlineCommentStartRe =
/(<!--\s*markdownlint-(disable|enable|capture|restore|disable-file|enable-file|disable-next-line|configure-file))(?:\s|-->)/ig;
module.exports.inlineCommentStartRe = inlineCommentStartRe;
// Regular expression for matching HTML elements
module.exports.htmlElementRe = /<(([A-Za-z][A-Za-z0-9-]*)(?:\s[^>]*)?)\/?>/g;
// Regular expressions for range matching
module.exports.bareUrlRe = /(?:http|ftp)s?:\/\/[^\s\]"']*(?:\/|[^\s\]"'\W])/ig;
module.exports.listItemMarkerRe = /^([\s>]*)(?:[*+-]|\d+[.)])\s+/;
@ -419,7 +422,7 @@ module.exports.forEachHeading = function forEachHeading(params, handler) {
} else if (token.type === "heading_close") {
heading = null;
} else if ((token.type === "inline") && heading) {
handler(heading, token.content);
handler(heading, token.content, token);
}
});
};