mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-23 09:20:12 +01:00
Update MD005, MD007, MD022, MD037, MD038 to not report violations within "htmlFlow" context (fixes #999).
This commit is contained in:
parent
2a56f130c1
commit
63325edc97
15 changed files with 511 additions and 149 deletions
12
lib/md038.js
12
lib/md038.js
|
|
@ -3,7 +3,8 @@
|
|||
"use strict";
|
||||
|
||||
const { addErrorContext } = require("../helpers");
|
||||
const { filterByTypes, tokenIfType } = require("../helpers/micromark.cjs");
|
||||
const { filterByTypes, inHtmlFlow, tokenIfType } =
|
||||
require("../helpers/micromark.cjs");
|
||||
|
||||
const leftSpaceRe = /^\s(?:[^`]|$)/;
|
||||
const rightSpaceRe = /[^`]\s$/;
|
||||
|
|
@ -23,10 +24,11 @@ module.exports = {
|
|||
"description": "Spaces inside code span elements",
|
||||
"tags": [ "whitespace", "code" ],
|
||||
"function": function MD038(params, onError) {
|
||||
const codeTextTokens =
|
||||
filterByTypes(params.parsers.micromark.tokens, [ "codeText" ]);
|
||||
for (const token of codeTextTokens) {
|
||||
const { children } = token;
|
||||
const codeTexts =
|
||||
filterByTypes(params.parsers.micromark.tokens, [ "codeText" ])
|
||||
.filter((codeText) => !inHtmlFlow(codeText));
|
||||
for (const codeText of codeTexts) {
|
||||
const { children } = codeText;
|
||||
const first = 0;
|
||||
const last = children.length - 1;
|
||||
const startSequence = tokenIfType(children[first], "codeTextSequence");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue