mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-17 06:20:12 +01:00
Add typings for Rule object to all Rule samples and examples.
This commit is contained in:
parent
cdc30b1279
commit
c287e49eac
11 changed files with 34 additions and 9 deletions
|
|
@ -4,6 +4,10 @@
|
|||
|
||||
const { filterTokens } = require("markdownlint-rule-helpers");
|
||||
|
||||
/** @typedef {import("../../lib/markdownlint").MarkdownItToken} MarkdownItToken */
|
||||
/** @typedef {(MarkdownItToken) => void} FilterTokensCallback */
|
||||
|
||||
/** @type import("../../lib/markdownlint").Rule */
|
||||
module.exports = {
|
||||
"names": [ "any-blockquote" ],
|
||||
"description": "Rule that reports an error for any blockquote",
|
||||
|
|
@ -13,13 +17,18 @@ module.exports = {
|
|||
),
|
||||
"tags": [ "test" ],
|
||||
"function": (params, onError) => {
|
||||
filterTokens(params, "blockquote_open", (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)
|
||||
});
|
||||
});
|
||||
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)
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue