Move single use, not explicitly tested helpers into the file that uses them.

This commit is contained in:
David Anson 2024-10-06 20:59:09 -07:00
parent df70ea5989
commit c5d4a3297f
5 changed files with 72 additions and 84 deletions

View file

@ -2,11 +2,26 @@
"use strict";
const { addError, emphasisOrStrongStyleFor } = require("../helpers");
const { addError } = require("../helpers");
const { filterByPredicate, getDescendantsByType } = require("../helpers/micromark-helpers.cjs");
const intrawordRe = /^\w$/;
/**
* Return the string representation of a emphasis or strong markup character.
*
* @param {string} markup Emphasis or strong string.
* @returns {"asterisk" | "underscore"} String representation.
*/
function emphasisOrStrongStyleFor(markup) {
switch (markup[0]) {
case "*":
return "asterisk";
default:
return "underscore";
}
};
/**
* @param {import("./markdownlint").RuleParams} params Rule parameters.
* @param {import("./markdownlint").RuleOnError} onError Error-reporting callback.