mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-17 06:20:12 +01:00
Update MD026/no-trailing-punctuation to ignore the trailing semicolon of HTML entity references (fixes #320).
This commit is contained in:
parent
09c5736385
commit
c693a9a3d8
3 changed files with 33 additions and 1 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue