// @ts-check "use strict"; const { addErrorContext, frontMatterHasTitle } = require("../helpers"); // eslint-disable-next-line jsdoc/valid-types /** @type import("./markdownlint").Rule */ module.exports = { "names": [ "MD041", "first-line-heading", "first-line-h1" ], "description": "First line in a file should be a top-level heading", "tags": [ "headings" ], "function": function MD041(params, onError) { const level = Number(params.config.level || 1); const tag = "h" + level; const foundFrontMatterTitle = frontMatterHasTitle( params.frontMatterLines, params.config.front_matter_title ); if (!foundFrontMatterTitle) { const htmlHeadingRe = new RegExp(`^]`, "i"); params.parsers.markdownit.tokens.every((token) => { let isError = false; if (token.type === "html_block") { if (token.content.startsWith("