Reimplement MD041/first-line-heading/first-line-h1 using micromark tokens.

This commit is contained in:
David Anson 2024-03-18 20:48:22 -07:00
parent 0f5e65abd4
commit a83e2d8a09
4 changed files with 94 additions and 80 deletions

View file

@ -2,19 +2,9 @@
"use strict";
const { addErrorContext, blockquotePrefixRe, isBlankLine } =
require("../helpers");
const { filterByPredicate } = require("../helpers/micromark.cjs");
const { addErrorContext, blockquotePrefixRe, isBlankLine } = require("../helpers");
const { filterByPredicate, nonContentTokens } = require("../helpers/micromark.cjs");
const nonContentTokens = new Set([
"blockQuoteMarker",
"blockQuotePrefix",
"blockQuotePrefixWhitespace",
"lineEnding",
"lineEndingBlank",
"linePrefix",
"listItemIndent"
]);
const isList = (token) => (
(token.type === "listOrdered") || (token.type === "listUnordered")
);