mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-18 06:50:12 +01:00
Add tags to README.md, new test and fix, comment rule code.
This commit is contained in:
parent
63a52e9dea
commit
0bd6dea637
5 changed files with 138 additions and 47 deletions
|
|
@ -5,13 +5,23 @@ var md = require("markdown-it")();
|
|||
var rules = require("./rules");
|
||||
var shared = require("./shared");
|
||||
|
||||
// Mapping from rule name to description
|
||||
// Mappings from rule to description and tag to rules
|
||||
var ruleToDescription = {};
|
||||
var tagToRules = {};
|
||||
rules.forEach(function forRule(rule) {
|
||||
ruleToDescription[rule.name] = rule.desc;
|
||||
// The following is useful for updating README.md
|
||||
// console.log("* " + rule.name + " - " + rule.desc);
|
||||
// console.log("* **" + rule.name + "** - " + rule.desc);
|
||||
rule.tags.forEach(function forTag(tag) {
|
||||
var tags = tagToRules[tag] || [];
|
||||
tags.push(rule.name);
|
||||
tagToRules[tag] = tags;
|
||||
});
|
||||
});
|
||||
// The following is useful for updating README.md
|
||||
// Object.keys(tagToRules).sort().forEach(function forTag(tag) {
|
||||
// console.log("* **" + tag + "** - " + tagToRules[tag].join(", "));
|
||||
// });
|
||||
|
||||
// Class for results with toString for pretty display
|
||||
function Results() { }
|
||||
|
|
@ -57,6 +67,10 @@ function lintFile(file, config, callback) {
|
|||
if (token.lines) {
|
||||
token.line = lines[token.lines[0]];
|
||||
token.lineNumber = token.lines[0] + 1;
|
||||
// Trim bottom of token to exclude whitespace lines
|
||||
while (!(lines[token.lines[1] - 1].trim())) {
|
||||
token.lines[1]--;
|
||||
}
|
||||
}
|
||||
});
|
||||
// Create parameters for rules
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue