mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-17 14:30:12 +01:00
Add front_matter_title parameter to MD025/single-title/single-h1 (refs #169).
This commit is contained in:
parent
050cbbba82
commit
61d6311a3e
14 changed files with 124 additions and 32 deletions
12
lib/md041.js
12
lib/md041.js
|
|
@ -11,13 +11,11 @@ module.exports = {
|
|||
"function": function MD041(params, onError) {
|
||||
const level = params.config.level || 1;
|
||||
const tag = "h" + level;
|
||||
const frontMatterTitle = params.config.front_matter_title;
|
||||
const ignoreFrontMatter =
|
||||
(frontMatterTitle !== undefined) && !frontMatterTitle;
|
||||
const frontMatterTitleRe =
|
||||
new RegExp(frontMatterTitle || "^\\s*title\\s*[:=]", "i");
|
||||
const foundFrontMatterTitle = !ignoreFrontMatter &&
|
||||
params.frontMatterLines.some((line) => frontMatterTitleRe.test(line));
|
||||
const foundFrontMatterTitle =
|
||||
shared.frontMatterHasTitle(
|
||||
params.frontMatterLines,
|
||||
params.config.front_matter_title
|
||||
);
|
||||
if (!foundFrontMatterTitle) {
|
||||
params.tokens.every((token) => {
|
||||
if (token.type === "html_block") {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue