Update MD026/no-trailing-punctuation to ignore the trailing semicolon of HTML entity references (fixes #320).

This commit is contained in:
David Anson 2020-11-23 15:23:39 -08:00
parent 09c5736385
commit c693a9a3d8
3 changed files with 33 additions and 1 deletions

View file

@ -5,6 +5,8 @@
const { addError, allPunctuationNoQuestion, escapeForRegExp, forEachHeading } =
require("../helpers");
const endOfLineHtmlEntityRe = /&#?[0-9a-zA-Z]+;$/;
module.exports = {
"names": [ "MD026", "no-trailing-punctuation" ],
"description": "Trailing punctuation in heading",
@ -20,7 +22,7 @@ module.exports = {
const { line, lineNumber } = heading;
const trimmedLine = line.replace(/[\s#]*$/, "");
const match = trailingPunctuationRe.exec(trimmedLine);
if (match) {
if (match && !endOfLineHtmlEntityRe.test(trimmedLine)) {
const fullMatch = match[0];
const column = match.index + 1;
const length = fullMatch.length;