Exclude htmlFlow content by default for filterByTypes, opt in as needed.

This commit is contained in:
David Anson 2024-06-09 17:09:03 -07:00
parent ea9659841e
commit 12502f6571
18 changed files with 206 additions and 129 deletions

View file

@ -4,8 +4,7 @@
const { addErrorDetailIf, blockquotePrefixRe, isBlankLine } =
require("../helpers");
const { filterByTypes, getHeadingLevel, inHtmlFlow } =
require("../helpers/micromark.cjs");
const { filterByTypes, getHeadingLevel } = require("../helpers/micromark.cjs");
const defaultLines = 1;
@ -50,7 +49,7 @@ module.exports = {
const headings = filterByTypes(
micromarkTokens,
[ "atxHeading", "setextHeading" ]
).filter((heading) => !inHtmlFlow(heading));
);
for (const heading of headings) {
const { startLine, endLine } = heading;
const line = lines[startLine - 1].trim();
@ -73,7 +72,7 @@ module.exports = {
actualAbove,
"Above",
line,
null,
undefined,
{
"insertText": getBlockQuote(
lines[startLine - 2],
@ -101,7 +100,7 @@ module.exports = {
actualBelow,
"Below",
line,
null,
undefined,
{
"lineNumber": endLine + 1,
"insertText": getBlockQuote(