Allow question mark by default for MD026/no-trailing-punctuation (fixes #276).

This commit is contained in:
David Anson 2020-11-17 20:32:17 -08:00
parent 3827842930
commit 6c1bc8ecb5
8 changed files with 30 additions and 16 deletions

View file

@ -2,7 +2,7 @@
"use strict";
const { addError, allPunctuation, escapeForRegExp, forEachHeading } =
const { addError, allPunctuationNoQuestion, escapeForRegExp, forEachHeading } =
require("../helpers");
module.exports = {
@ -11,8 +11,9 @@ module.exports = {
"tags": [ "headings", "headers" ],
"function": function MD026(params, onError) {
let punctuation = params.config.punctuation;
punctuation =
String((punctuation === undefined) ? allPunctuation : punctuation);
punctuation = String(
(punctuation === undefined) ? allPunctuationNoQuestion : punctuation
);
const trailingPunctuationRe =
new RegExp("\\s*[" + escapeForRegExp(punctuation) + "]+$");
forEachHeading(params, (heading) => {