mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-17 06:20:12 +01:00
Relax MD041/first-line-h1 to allow blank links above the top level header (fixes #116).
This commit is contained in:
parent
017fe127fa
commit
072da48add
5 changed files with 30 additions and 17 deletions
15
lib/md041.js
15
lib/md041.js
|
|
@ -14,17 +14,14 @@ module.exports = {
|
|||
const tag = "h" + level;
|
||||
const frontMatterTitleRe =
|
||||
new RegExp(frontMatterTitle || "^\\s*title\\s*[:=]", "i");
|
||||
params.tokens.every(function forToken(token, index) {
|
||||
if (token.type === "heading_open") {
|
||||
if (!((token.lineNumber === 1) || (index > 0)) ||
|
||||
(token.tag !== tag)) {
|
||||
params.tokens.every(function forToken(token) {
|
||||
if (token.type === "html_block") {
|
||||
return true;
|
||||
} else if (token.type === "heading_open") {
|
||||
if (token.tag !== tag) {
|
||||
shared.addErrorContext(onError, token.lineNumber, token.line);
|
||||
}
|
||||
return false;
|
||||
} else if (token.type === "html_block") {
|
||||
return true;
|
||||
}
|
||||
if (((frontMatterTitle !== undefined) && !frontMatterTitle) ||
|
||||
} else if (((frontMatterTitle !== undefined) && !frontMatterTitle) ||
|
||||
!params.frontMatterLines.some(function forLine(line) {
|
||||
return frontMatterTitleRe.test(line);
|
||||
})) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue