1
0
forked from Rowland/EG
EG/Cesium-1.132/node_modules/markdownlint/lib/md046.mjs
2025-08-25 17:48:13 +08:00

32 lines
867 B
JavaScript

// @ts-check
import { addErrorDetailIf } from "../helpers/helpers.cjs";
import { filterByTypesCached } from "./cache.mjs";
const tokenTypeToStyle = {
"codeFenced": "fenced",
"codeIndented": "indented"
};
/** @type {import("markdownlint").Rule} */
export default {
"names": [ "MD046", "code-block-style" ],
"description": "Code block style",
"tags": [ "code" ],
"parser": "micromark",
"function": function MD046(params, onError) {
let expectedStyle = String(params.config.style || "consistent");
for (const token of filterByTypesCached([ "codeFenced", "codeIndented" ])) {
const { startLine, type } = token;
if (expectedStyle === "consistent") {
expectedStyle = tokenTypeToStyle[type];
}
addErrorDetailIf(
onError,
startLine,
expectedStyle,
tokenTypeToStyle[type]);
}
}
};