Update MD037 to handle violations at the start/end of a line.

This commit is contained in:
David Anson 2019-03-04 19:24:57 -08:00
parent 4d436be500
commit dd3bd3d7ee
2 changed files with 36 additions and 2 deletions

View file

@ -11,10 +11,10 @@ module.exports = {
"function": function MD037(params, onError) {
shared.forEachInlineChild(params, "text", function forToken(token) {
let left = true;
let match = /\s(\*\*?|__?)\s.+\1/.exec(token.content);
let match = /(?:^|\s)(\*\*?|__?)\s.+\1/.exec(token.content);
if (!match) {
left = false;
match = /(\*\*?|__?).+\s\1\s/.exec(token.content);
match = /(\*\*?|__?).+\s\1(?:\s|$)/.exec(token.content);
}
if (match) {
const text = match[0].trim();