2018-01-21 21:44:25 -08:00
|
|
|
// @ts-check
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
|
2024-02-25 15:06:28 -08:00
|
|
|
const { addErrorContext } = require("../helpers");
|
2024-08-24 22:05:16 -07:00
|
|
|
const { filterByTypesCached } = require("./cache");
|
2018-01-21 21:44:25 -08:00
|
|
|
|
2024-02-27 20:42:09 -08:00
|
|
|
// eslint-disable-next-line jsdoc/valid-types
|
|
|
|
/** @type import("./markdownlint").Rule */
|
2018-01-21 21:44:25 -08:00
|
|
|
module.exports = {
|
2024-09-01 16:16:05 -07:00
|
|
|
"names": [ "MD027", "no-multiple-space-blockquote" ],
|
2018-01-21 21:44:25 -08:00
|
|
|
"description": "Multiple spaces after blockquote symbol",
|
2024-09-01 16:16:05 -07:00
|
|
|
"tags": [ "blockquote", "whitespace", "indentation" ],
|
2024-03-09 16:17:50 -08:00
|
|
|
"parser": "micromark",
|
2018-01-21 21:44:25 -08:00
|
|
|
"function": function MD027(params, onError) {
|
2024-08-24 22:05:16 -07:00
|
|
|
for (const token of filterByTypesCached([ "linePrefix" ])) {
|
|
|
|
const siblings = token.parent?.children || params.parsers.micromark.tokens;
|
2024-02-26 21:07:24 -08:00
|
|
|
if (siblings[siblings.indexOf(token) - 1]?.type === "blockQuotePrefix") {
|
|
|
|
const { startColumn, startLine, text } = token;
|
|
|
|
const { length } = text;
|
|
|
|
const line = params.lines[startLine - 1];
|
|
|
|
addErrorContext(
|
|
|
|
onError,
|
|
|
|
startLine,
|
|
|
|
line,
|
2024-06-21 21:03:30 -07:00
|
|
|
undefined,
|
|
|
|
undefined,
|
2024-02-26 21:07:24 -08:00
|
|
|
[ startColumn, length ],
|
|
|
|
{
|
|
|
|
"editColumn": startColumn,
|
|
|
|
"deleteCount": length
|
|
|
|
}
|
|
|
|
);
|
2018-01-21 21:44:25 -08:00
|
|
|
}
|
2022-06-08 22:10:27 -07:00
|
|
|
}
|
2018-01-21 21:44:25 -08:00
|
|
|
}
|
|
|
|
};
|