mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-09-21 21:30:47 +02:00
Add example, stop modifying files array, rename "styles".
This commit is contained in:
parent
d3e9f83e7c
commit
9917d7f2fb
7 changed files with 44 additions and 2 deletions
3
example/bad.md
Normal file
3
example/bad.md
Normal file
|
@ -0,0 +1,3 @@
|
|||
#bad.md
|
||||
|
||||
#This file fails some rules.
|
3
example/good.md
Normal file
3
example/good.md
Normal file
|
@ -0,0 +1,3 @@
|
|||
# good.md
|
||||
|
||||
This file passes all rules.
|
21
example/standalone.js
Normal file
21
example/standalone.js
Normal file
|
@ -0,0 +1,21 @@
|
|||
"use strict";
|
||||
|
||||
var markdownlint = require("../lib/markdownlint");
|
||||
|
||||
var options = {
|
||||
"files": [ "good.md", "bad.md" ]
|
||||
};
|
||||
|
||||
// Uses result.toString for pretty formatting
|
||||
markdownlint(options, function callback(err, result) {
|
||||
if (!err) {
|
||||
console.log(result.toString());
|
||||
}
|
||||
});
|
||||
|
||||
// Examines the result object directly
|
||||
markdownlint(options, function callback(err, result) {
|
||||
if (!err) {
|
||||
console.dir(result, { "colors": true });
|
||||
}
|
||||
});
|
|
@ -77,7 +77,7 @@ function lintFile(file, config, callback) {
|
|||
module.exports = function markdownlint(options, callback) {
|
||||
options = options || {};
|
||||
callback = callback || function noop() {};
|
||||
var files = options.files || [];
|
||||
var files = (options.files || []).slice();
|
||||
var config = options.config || { "default": true };
|
||||
var results = new Results();
|
||||
function lintFiles() {
|
||||
|
|
|
@ -17,7 +17,8 @@
|
|||
"test": "nodeunit",
|
||||
"test-cover": "istanbul cover node_modules/nodeunit/bin/nodeunit",
|
||||
"debug": "node debug node_modules/nodeunit/bin/nodeunit",
|
||||
"lint": "eslint lib test"
|
||||
"lint": "eslint lib test & eslint --rule \"no-console: 0\" example",
|
||||
"example": "cd example & node standalone.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"markdown-it": "^3.0.7"
|
||||
|
|
|
@ -118,6 +118,20 @@ module.exports.resultFormatting = function resultFormatting(test) {
|
|||
});
|
||||
};
|
||||
|
||||
module.exports.filesNotModified = function filesNotModified(test) {
|
||||
test.expect(2);
|
||||
var files = [
|
||||
"./test/atx_header_spacing.md",
|
||||
"./test/first_header_bad_atx.md"
|
||||
];
|
||||
var expectedFiles = files.slice();
|
||||
markdownlint({ "files": files }, function callback(err) {
|
||||
test.ifError(err);
|
||||
test.deepEqual(files, expectedFiles, "Files modified.");
|
||||
test.done();
|
||||
});
|
||||
};
|
||||
|
||||
module.exports.missingOptions = function missingOptions(test) {
|
||||
test.expect(2);
|
||||
markdownlint(null, function callback(err, result) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue