mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-16 22:10:13 +01:00
Add MD050/strong-style (fixes #150).
This commit is contained in:
parent
6294ad3ef0
commit
ab9e5875a2
23 changed files with 255 additions and 19 deletions
28
lib/md050.js
Normal file
28
lib/md050.js
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
// @ts-check
|
||||
|
||||
"use strict";
|
||||
|
||||
const { addErrorDetailIf, emphasisOrStrongStyleFor, forEachInlineChild } =
|
||||
require("../helpers");
|
||||
|
||||
module.exports = {
|
||||
"names": [ "MD050", "strong-style" ],
|
||||
"description": "Strong style should be consistent",
|
||||
"tags": [ "emphasis" ],
|
||||
"function": function MD050(params, onError) {
|
||||
let expectedStyle = String(params.config.style || "consistent");
|
||||
forEachInlineChild(params, "strong_open", (token) => {
|
||||
const { lineNumber, markup } = token;
|
||||
const markupStyle = emphasisOrStrongStyleFor(markup);
|
||||
if (expectedStyle === "consistent") {
|
||||
expectedStyle = markupStyle;
|
||||
}
|
||||
addErrorDetailIf(
|
||||
onError,
|
||||
lineNumber,
|
||||
expectedStyle,
|
||||
markupStyle
|
||||
);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
@ -50,7 +50,8 @@ const rules = [
|
|||
require("./md045"),
|
||||
require("./md046"),
|
||||
require("./md047"),
|
||||
require("./md048")
|
||||
require("./md048"),
|
||||
require("./md050")
|
||||
];
|
||||
rules.forEach((rule) => {
|
||||
const name = rule.names[0].toLowerCase();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue