2018-01-21 21:44:25 -08:00
|
|
|
// @ts-check
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
|
2024-02-25 15:06:28 -08:00
|
|
|
const { addErrorContext } = require("../helpers");
|
|
|
|
const { getSiblingTokens } = require("../helpers/micromark.cjs");
|
2018-01-21 21:44:25 -08:00
|
|
|
|
|
|
|
module.exports = {
|
2024-02-25 15:06:28 -08:00
|
|
|
"names": ["MD027", "no-multiple-space-blockquote"],
|
2018-01-21 21:44:25 -08:00
|
|
|
"description": "Multiple spaces after blockquote symbol",
|
2024-02-25 15:06:28 -08:00
|
|
|
"tags": ["blockquote", "whitespace", "indentation"],
|
2018-01-21 21:44:25 -08:00
|
|
|
"function": function MD027(params, onError) {
|
2024-02-25 15:06:28 -08:00
|
|
|
for (const siblings of getSiblingTokens(params.parsers.micromark.tokens)) {
|
|
|
|
let previousType = null;
|
|
|
|
for (const token of siblings) {
|
|
|
|
const { type } = token;
|
|
|
|
if ((type === "linePrefix") && (previousType === "blockQuotePrefix")) {
|
2024-02-26 20:34:47 -08:00
|
|
|
const { startColumn, startLine, text } = token;
|
|
|
|
const { length } = text;
|
2024-02-25 15:06:28 -08:00
|
|
|
const line = params.lines[startLine - 1];
|
|
|
|
addErrorContext(
|
|
|
|
onError,
|
|
|
|
startLine,
|
|
|
|
line,
|
|
|
|
null,
|
|
|
|
null,
|
2024-02-26 20:34:47 -08:00
|
|
|
[ startColumn, length ],
|
2024-02-25 15:06:28 -08:00
|
|
|
{
|
|
|
|
"editColumn": startColumn,
|
2024-02-26 20:34:47 -08:00
|
|
|
"deleteCount": length
|
2018-01-21 21:44:25 -08:00
|
|
|
}
|
2024-02-25 15:06:28 -08:00
|
|
|
);
|
2019-09-09 22:03:59 -07:00
|
|
|
}
|
2024-02-25 15:06:28 -08:00
|
|
|
previousType = type;
|
2018-01-21 21:44:25 -08:00
|
|
|
}
|
2022-06-08 22:10:27 -07:00
|
|
|
}
|
2018-01-21 21:44:25 -08:00
|
|
|
}
|
|
|
|
};
|