mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-17 06:20:12 +01:00
Refactor helpers slightly for consistency.
This commit is contained in:
parent
124b7e2276
commit
97effd921e
6 changed files with 36 additions and 50 deletions
|
|
@ -3,7 +3,7 @@
|
|||
"use strict";
|
||||
|
||||
const { addErrorContext, isBlankLine } = require("../helpers");
|
||||
const { getTokenParentOfType } = require("../helpers/micromark.cjs");
|
||||
const { getParentOfType } = require("../helpers/micromark.cjs");
|
||||
const { filterByTypesCached } = require("./cache");
|
||||
|
||||
const codeFencePrefixRe = /^(.*?)[`~]/;
|
||||
|
|
@ -52,7 +52,7 @@ module.exports = {
|
|||
const includeListItems = (listItems === undefined) ? true : !!listItems;
|
||||
const { lines } = params;
|
||||
for (const codeBlock of filterByTypesCached([ "codeFenced" ])) {
|
||||
if (includeListItems || !(getTokenParentOfType(codeBlock, [ "listOrdered", "listUnordered" ]))) {
|
||||
if (includeListItems || !(getParentOfType(codeBlock, [ "listOrdered", "listUnordered" ]))) {
|
||||
if (!isBlankLine(lines[codeBlock.startLine - 2])) {
|
||||
addError(onError, lines, codeBlock.startLine, true);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue