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

@ -3,7 +3,7 @@
"use strict";
const { addError } = require("../helpers");
const { filterByPredicate } = require("../helpers/micromark.cjs");
const { filterByPredicate, inHtmlFlow } = require("../helpers/micromark.cjs");
module.exports = {
"names": [ "MD037", "no-space-in-emphasis" ],
@ -31,7 +31,7 @@ module.exports = {
const { text, type } = child;
if ((type === "data") && (text.length <= 3)) {
const emphasisTokens = emphasisTokensByMarker.get(text);
if (emphasisTokens) {
if (emphasisTokens && !inHtmlFlow(child)) {
emphasisTokens.push(child);
}
}