/** * @fileoverview Rule to enforce reference-style links when URL matches a defined identifier. * @author TKDev7 */ //----------------------------------------------------------------------------- // Imports //----------------------------------------------------------------------------- import { normalizeIdentifier } from "micromark-util-normalize-identifier"; //----------------------------------------------------------------------------- // Type Definitions //----------------------------------------------------------------------------- /** * @import { Image, Link } from "mdast"; * @import { MarkdownRuleDefinition } from "../types.js"; * @typedef {"referenceLikeUrl"} NoReferenceLikeUrlsMessageIds * @typedef {[]} NoReferenceLikeUrlsOptions * @typedef {MarkdownRuleDefinition<{ RuleOptions: NoReferenceLikeUrlsOptions, MessageIds: NoReferenceLikeUrlsMessageIds }>} NoReferenceLikeUrlsRuleDefinition */ //----------------------------------------------------------------------------- // Helpers //----------------------------------------------------------------------------- /** Pattern to match both inline links: `[text](url)` and images: `![alt](url)`, with optional title */ const linkOrImagePattern = /\[(?