Split micromark.cjs into separate -parse and -helpers files.

This commit is contained in:
David Anson 2024-09-28 16:26:38 -07:00
parent 5701d0bf52
commit 33631a5984
47 changed files with 353 additions and 1236 deletions

View file

@ -3,15 +3,15 @@
"use strict";
const { addErrorContext } = require("../helpers");
const { filterByTypes } = require("../helpers/micromark.cjs");
const { filterByTypes } = require("../helpers/micromark-helpers.cjs");
const { getReferenceLinkImageData, filterByTypesCached } = require("./cache");
/**
* Adds an error for a label space issue.
*
* @param {import("./markdownlint").RuleOnError} onError Error-reporting callback.
* @param {import("../helpers/micromark.cjs").Token} label Label token.
* @param {import("../helpers/micromark.cjs").Token} labelText LabelText token.
* @param {import("../helpers/micromark-helpers.cjs").Token} label Label token.
* @param {import("../helpers/micromark-helpers.cjs").Token} labelText LabelText token.
* @param {boolean} isStart True iff error is at the start of the link.
*/
function addLabelSpaceError(onError, label, labelText, isStart) {
@ -41,8 +41,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.cjs").Token} label Label token.
* @param {import("../helpers/micromark.cjs").Token} labelText LabelText token.
* @param {import("../helpers/micromark-helpers.cjs").Token} label Label token.
* @param {import("../helpers/micromark-helpers.cjs").Token} labelText LabelText token.
* @param {Map<string, any>} definitions Map of link definitions.
* @returns {boolean} True iff the link is valid.
*/