Update to use named exports via / /async /promise /sync, simplify references via self-referencing, refine examples.

This commit is contained in:
David Anson 2024-12-03 19:58:28 -08:00
parent e41f034bef
commit 8da43dd246
96 changed files with 635 additions and 548 deletions

View file

@ -6,9 +6,9 @@ import { getReferenceLinkImageData, filterByTypesCached } from "./cache.mjs";
/**
* Adds an error for a label space issue.
*
* @param {import("./markdownlint.mjs").RuleOnError} onError Error-reporting callback.
* @param {import("../helpers/micromark-helpers.cjs").Token} label Label token.
* @param {import("../helpers/micromark-helpers.cjs").Token} labelText LabelText token.
* @param {import("markdownlint").RuleOnError} onError Error-reporting callback.
* @param {import("markdownlint").MicromarkToken} label Label token.
* @param {import("markdownlint").MicromarkToken} labelText LabelText token.
* @param {boolean} isStart True iff error is at the start of the link.
*/
function addLabelSpaceError(onError, label, labelText, isStart) {
@ -38,8 +38,8 @@ function addLabelSpaceError(onError, label, labelText, isStart) {
/**
* Determines if a link is a valid link (and not a fake shortcut link due to parser tricks).
*
* @param {import("../helpers/micromark-helpers.cjs").Token} label Label token.
* @param {import("../helpers/micromark-helpers.cjs").Token} labelText LabelText token.
* @param {import("markdownlint").MicromarkToken} label Label token.
* @param {import("markdownlint").MicromarkToken} labelText LabelText token.
* @param {Map<string, any>} definitions Map of link definitions.
* @returns {boolean} True iff the link is valid.
*/
@ -47,7 +47,7 @@ function validLink(label, labelText, definitions) {
return (label.parent?.children.length !== 1) || definitions.has(labelText.text.trim());
}
/** @type {import("./markdownlint.mjs").Rule} */
/** @type {import("markdownlint").Rule} */
export default {
"names": [ "MD039", "no-space-in-links" ],
"description": "Spaces inside link text",