mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-17 22:40:13 +01:00
Expose shared.js helper code for custom rule authors (fixes #134).
This commit is contained in:
parent
f614f3e1ce
commit
7e980401b8
52 changed files with 283 additions and 184 deletions
12
lib/md027.js
12
lib/md027.js
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
const shared = require("./shared");
|
||||
const { addErrorContext, newLineRe, rangeFromRegExp } = require("../helpers");
|
||||
|
||||
const spaceAfterBlockQuote = /^\s*(?:>\s+)+\S/;
|
||||
|
||||
|
|
@ -27,15 +27,15 @@ module.exports = {
|
|||
/^(\s*>)+\s\s+>/.test(token.line) :
|
||||
/^(\s*>)+\s\s/.test(token.line);
|
||||
if (multipleSpaces) {
|
||||
shared.addErrorContext(onError, token.lineNumber, token.line, null,
|
||||
null, shared.rangeFromRegExp(token.line, spaceAfterBlockQuote));
|
||||
addErrorContext(onError, token.lineNumber, token.line, null,
|
||||
null, rangeFromRegExp(token.line, spaceAfterBlockQuote));
|
||||
}
|
||||
token.content.split(shared.newLineRe)
|
||||
token.content.split(newLineRe)
|
||||
.forEach(function forLine(line, offset) {
|
||||
if (/^\s/.test(line)) {
|
||||
shared.addErrorContext(onError, token.lineNumber + offset,
|
||||
addErrorContext(onError, token.lineNumber + offset,
|
||||
"> " + line, null, null,
|
||||
shared.rangeFromRegExp(line, spaceAfterBlockQuote));
|
||||
rangeFromRegExp(line, spaceAfterBlockQuote));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue