Update MD005, MD007, MD022, MD037, MD038 to not report violations within "htmlFlow" context (fixes #999).

This commit is contained in:
David Anson 2023-10-21 22:03:11 -07:00
parent 2a56f130c1
commit 63325edc97
15 changed files with 511 additions and 149 deletions

View file

@ -4,7 +4,7 @@
const { addErrorDetailIf, blockquotePrefixRe, isBlankLine } =
require("../helpers");
const { filterByTypes, getHeadingLevel } =
const { filterByTypes, getHeadingLevel, inHtmlFlow } =
require("../helpers/micromark.cjs");
const defaultLines = 1;
@ -42,7 +42,7 @@ module.exports = {
const headings = filterByTypes(
parsers.micromark.tokens,
[ "atxHeading", "setextHeading" ]
);
).filter((heading) => !inHtmlFlow(heading));
for (const heading of headings) {
const { startLine, endLine } = heading;
const line = lines[startLine - 1].trim();