mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-16 22:10:13 +01:00
Convert markdownlint library to an ECMAScript module, replace markdownlint-micromark with micromark, stop publishing (large) markdownlint-browser.js, see https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c for guidance.
This commit is contained in:
parent
191226f070
commit
1e71f6f44e
140 changed files with 1087 additions and 10428 deletions
40
lib/md027.mjs
Normal file
40
lib/md027.mjs
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
// @ts-check
|
||||
|
||||
import { addErrorContext } from "../helpers/helpers.cjs";
|
||||
import { filterByTypesCached } from "./cache.mjs";
|
||||
|
||||
/** @type {import("./markdownlint.mjs").Rule} */
|
||||
export default {
|
||||
"names": [ "MD027", "no-multiple-space-blockquote" ],
|
||||
"description": "Multiple spaces after blockquote symbol",
|
||||
"tags": [ "blockquote", "whitespace", "indentation" ],
|
||||
"parser": "micromark",
|
||||
"function": function MD027(params, onError) {
|
||||
const { tokens } = params.parsers.micromark;
|
||||
for (const token of filterByTypesCached([ "linePrefix" ])) {
|
||||
const parent = token.parent;
|
||||
const codeIndented = parent?.type === "codeIndented";
|
||||
const siblings = parent?.children || tokens;
|
||||
if (
|
||||
!codeIndented &&
|
||||
(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,
|
||||
undefined,
|
||||
undefined,
|
||||
[ startColumn, length ],
|
||||
{
|
||||
"editColumn": startColumn,
|
||||
"deleteCount": length
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue