Add br_spaces parameter to MD009.

This commit is contained in:
David Anson 2015-04-14 09:07:25 -07:00
parent 0e24df7cf7
commit 9acbb2750e
4 changed files with 25 additions and 1 deletions

View file

@ -237,8 +237,11 @@ module.exports = [
"desc": "Trailing spaces",
"tags": [ "whitespace" ],
"func": function MD009(params, errors) {
var brSpaces = params.options.br_spaces || 0;
params.lines.forEach(function forLine(line, lineIndex) {
if (/\s$/.test(line)) {
if (/\s$/.test(line) &&
((brSpaces < 2) ||
(line.length - line.trimRight().length !== brSpaces))) {
errors.push(lineIndex + 1);
}
});