mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-17 06:20:12 +01:00
Remove filterTokens helper (now used only by tests).
This commit is contained in:
parent
2b8369ae39
commit
55729cfcf7
5 changed files with 21 additions and 61 deletions
|
|
@ -2,11 +2,6 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
const { filterTokens } = require("../../helpers");
|
||||
|
||||
/** @typedef {import("../../lib/markdownlint").MarkdownItToken} MarkdownItToken */
|
||||
/** @typedef {(MarkdownItToken) => void} FilterTokensCallback */
|
||||
|
||||
/** @type import("../../lib/markdownlint").Rule */
|
||||
module.exports = {
|
||||
"names": [ "any-blockquote" ],
|
||||
|
|
@ -18,18 +13,15 @@ module.exports = {
|
|||
"tags": [ "test" ],
|
||||
"parser": "markdownit",
|
||||
"function": (params, onError) => {
|
||||
filterTokens(
|
||||
params,
|
||||
"blockquote_open",
|
||||
/** @type FilterTokensCallback */
|
||||
(blockquote) => {
|
||||
const lines = blockquote.map[1] - blockquote.map[0];
|
||||
onError({
|
||||
"lineNumber": blockquote.lineNumber,
|
||||
"detail": "Blockquote spans " + lines + " line(s).",
|
||||
"context": blockquote.line.substr(0, 7)
|
||||
});
|
||||
}
|
||||
);
|
||||
const blockquotes = params.parsers.markdownit.tokens.
|
||||
filter((token => token.type === "blockquote_open"));
|
||||
for (const blockquote of blockquotes) {
|
||||
const lines = blockquote.map[1] - blockquote.map[0];
|
||||
onError({
|
||||
"lineNumber": blockquote.lineNumber,
|
||||
"detail": "Blockquote spans " + lines + " line(s).",
|
||||
"context": blockquote.line.substr(0, 7)
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue