mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-20 07:50:12 +01:00
Expose shared.js helper code for custom rule authors (fixes #134).
This commit is contained in:
parent
f614f3e1ce
commit
7e980401b8
52 changed files with 283 additions and 184 deletions
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
const shared = require("./shared");
|
||||
const { addErrorContext, frontMatterHasTitle } = require("../helpers");
|
||||
|
||||
module.exports = {
|
||||
"names": [ "MD041", "first-line-heading", "first-line-h1" ],
|
||||
|
|
@ -12,7 +12,7 @@ module.exports = {
|
|||
const level = params.config.level || 1;
|
||||
const tag = "h" + level;
|
||||
const foundFrontMatterTitle =
|
||||
shared.frontMatterHasTitle(
|
||||
frontMatterHasTitle(
|
||||
params.frontMatterLines,
|
||||
params.config.front_matter_title
|
||||
);
|
||||
|
|
@ -22,7 +22,7 @@ module.exports = {
|
|||
return true;
|
||||
}
|
||||
if ((token.type !== "heading_open") || (token.tag !== tag)) {
|
||||
shared.addErrorContext(onError, token.lineNumber, token.line);
|
||||
addErrorContext(onError, token.lineNumber, token.line);
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue