2015-03-13 18:20:56 -07:00
|
|
|
"use strict";
|
|
|
|
|
2018-04-27 22:05:34 -07:00
|
|
|
const markdownlint = require("../lib/markdownlint");
|
2015-03-13 18:20:56 -07:00
|
|
|
|
2018-04-27 22:05:34 -07:00
|
|
|
const options = {
|
2015-04-29 18:46:52 -07:00
|
|
|
"files": [ "good.md", "bad.md" ],
|
|
|
|
"strings": {
|
|
|
|
"good.string": "# good.string\n\nThis string passes all rules.",
|
|
|
|
"bad.string": "#bad.string\n\n#This string fails\tsome rules."
|
|
|
|
}
|
2015-03-13 18:20:56 -07:00
|
|
|
};
|
|
|
|
|
2017-07-05 21:53:21 -07:00
|
|
|
// Makes a synchronous call, using result.toString for pretty formatting
|
2018-04-27 22:05:34 -07:00
|
|
|
const result = markdownlint.sync(options);
|
2017-07-05 21:53:21 -07:00
|
|
|
console.log(result.toString());
|
2015-03-13 18:20:56 -07:00
|
|
|
|
2017-07-05 21:53:21 -07:00
|
|
|
// Makes an asynchronous call
|
2015-03-13 18:20:56 -07:00
|
|
|
markdownlint(options, function callback(err, result) {
|
|
|
|
if (!err) {
|
2017-07-05 21:53:21 -07:00
|
|
|
console.log(result.toString());
|
2015-03-13 18:20:56 -07:00
|
|
|
}
|
|
|
|
});
|
2015-03-20 00:09:55 -07:00
|
|
|
|
2017-07-05 21:53:21 -07:00
|
|
|
// Displays the result object directly
|
2016-10-16 21:46:02 -07:00
|
|
|
markdownlint(options, function callback(err, result) {
|
|
|
|
if (!err) {
|
2016-10-31 22:53:46 -07:00
|
|
|
console.dir(result, { "colors": true, "depth": null });
|
2016-10-16 21:46:02 -07:00
|
|
|
}
|
|
|
|
});
|