markdownlint/test/rules/any-blockquote.js

22 lines
617 B
JavaScript
Raw Normal View History

2018-02-15 21:35:58 -08:00
// @ts-check
"use strict";
module.exports = {
"names": [ "any-blockquote" ],
"description": "Rule that reports an error for any blockquote",
2018-02-15 21:35:58 -08:00
"tags": [ "test" ],
"function": function rule(params, onError) {
params.tokens.filter(function filterToken(token) {
return token.type === "blockquote_open";
}).forEach(function forToken(blockquote) {
var lines = blockquote.map[1] - blockquote.map[0];
onError({
"lineNumber": blockquote.lineNumber,
"detail": "Blockquote spans " + lines + " line(s).",
"context": blockquote.line.substr(0, 7)
2018-02-15 21:35:58 -08:00
});
});
}
};