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,10 +2,25 @@
"use strict";
const { addErrorDetailIf, fencedCodeBlockStyleFor } = require("../helpers");
const { addErrorDetailIf } = require("../helpers");
const { getDescendantsByType } = require("../helpers/micromark-helpers.cjs");
const { filterByTypesCached } = require("./cache");
/**
* Return the string representation of a fence markup character.
*
* @param {string} markup Fence string.
* @returns {"tilde" | "backtick"} String representation.
*/
function fencedCodeBlockStyleFor(markup) {
switch (markup[0]) {
case "~":
return "tilde";
default:
return "backtick";
}
};
// eslint-disable-next-line jsdoc/valid-types
/** @type import("./markdownlint").Rule */
module.exports = {