Update MD003 to support setext_with_atx.

This commit is contained in:
David Anson 2015-07-29 22:17:33 -07:00
parent c2aff32460
commit fd1215d143
4 changed files with 33 additions and 5 deletions

View file

@ -173,10 +173,14 @@ module.exports = [
"func": function MD003(params, errors) {
var style = params.options.style || "consistent";
filterTokens(params, "heading_open", function forToken(token) {
var styleForToken = headingStyleFor(token);
if (style === "consistent") {
style = headingStyleFor(token);
style = styleForToken;
}
if (headingStyleFor(token) !== style) {
if ((styleForToken !== style) &&
!((style === "setext_with_atx") &&
(/h[12]/.test(token.tag) && (styleForToken === "setext")) ||
(/h[^12]/.test(token.tag) && (styleForToken === "atx")))) {
errors.push(token.lineNumber);
}
});