mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-09-22 05:40:48 +02:00
Refine previous commit for MD051/link-fragments to tweak behavior, tests, and documentation.
This commit is contained in:
parent
242b35f98f
commit
45c8766eda
8 changed files with 259 additions and 148 deletions
|
@ -5383,6 +5383,7 @@ const {
|
|||
const idRe = getHtmlAttributeRe("id");
|
||||
const nameRe = getHtmlAttributeRe("name");
|
||||
const anchorRe = /\{(#[a-z\d]+(?:[-_][a-z\d]+)*)\}/gu;
|
||||
const lineFragmentRe = /^#(?:L\d+(?:C\d+)?-L\d+(?:C\d+)?|L\d+)$/;
|
||||
|
||||
// Sets for filtering heading tokens during conversion
|
||||
const childrenExclude = new Set(["image", "reference", "resource"]);
|
||||
|
@ -5471,7 +5472,6 @@ module.exports = {
|
|||
} = definition;
|
||||
const text = unescapeStringTokenText(definition);
|
||||
const encodedText = `#${encodeURIComponent(text.slice(1))}`;
|
||||
const lineFragmentRe = /^#L\d+(?:C\d+)?(?:-L\d+(?:C\d+)?)?$/;
|
||||
if (text.length > 1 && text.startsWith("#") && !fragments.has(encodedText) && !lineFragmentRe.test(encodedText)) {
|
||||
// eslint-disable-next-line no-undef-init
|
||||
let context = undefined;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue