mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-09-22 05:40:48 +02:00
Add support for disabling/enabling rules within Markdown content (fixes #5).
This commit is contained in:
parent
071bba88fc
commit
31141cc3ed
10 changed files with 192 additions and 42 deletions
|
@ -6,5 +6,23 @@ module.exports.newLineRe = /\r\n|\r|\n/;
|
|||
// Regular expression for matching common front matter
|
||||
module.exports.frontMatterRe = /^---$[^]*?^---$(\r\n|\r|\n)/m;
|
||||
|
||||
// Regular expression for matching inline disable/enable comments
|
||||
module.exports.inlineCommentRe =
|
||||
/<!--\s*markdownlint-(dis|en)able((?:\s+[a-z0-9_]+)*)\s*-->/ig;
|
||||
|
||||
// readFile options for reading with the UTF-8 encoding
|
||||
module.exports.utf8Encoding = { "encoding": "utf8" };
|
||||
|
||||
// Applies key/value pairs from src to dst, returning dst
|
||||
function assign(dst, src) {
|
||||
Object.keys(src).forEach(function forKey(key) {
|
||||
dst[key] = src[key];
|
||||
});
|
||||
return dst;
|
||||
}
|
||||
module.exports.assign = assign;
|
||||
|
||||
// Clones the key/value pairs of obj, returning the clone
|
||||
module.exports.clone = function clone(obj) {
|
||||
return assign({}, obj);
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue