Update MD018/no-missing-space-atx and MD020/no-missing-space-closed-atx to ignore the content of HTML blocks (fixes #1268).

This commit is contained in:
Fu Yuchen 2024-07-20 13:38:45 +08:00 committed by GitHub
parent a80387a0a0
commit 6c8d0fdef8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 76 additions and 8 deletions

View file

@ -13,8 +13,9 @@ module.exports = {
"tags": [ "headings", "atx_closed", "spaces" ],
"parser": "none",
"function": function MD020(params, onError) {
forEachLine(lineMetadata(), (line, lineIndex, inCode) => {
if (!inCode) {
forEachLine(lineMetadata(), (line, lineIndex, inCode, inFence, inTable, inItem, inBreak, inHtml) => {
if (!inCode &&
!inHtml) {
const match =
/^(#+)([ \t]*)([^#]*?[^#\\])([ \t]*)((?:\\#)?)(#+)(\s*)$/.exec(line);
if (match) {