mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-17 06:20:12 +01:00
29 lines
766 B
JavaScript
29 lines
766 B
JavaScript
|
|
// @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
|
||
|
|
);
|
||
|
|
});
|
||
|
|
}
|
||
|
|
};
|