mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-16 22:10:13 +01:00
MD037 should try to ignore escaped emphasis markers (fixes #168).
This commit is contained in:
parent
dd3bd3d7ee
commit
2ccacf03f5
2 changed files with 39 additions and 7 deletions
17
lib/md037.js
17
lib/md037.js
|
|
@ -11,18 +11,21 @@ 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();
|
||||
const fullText = match[0];
|
||||
const line = params.lines[token.lineNumber - 1];
|
||||
const column = line.indexOf(text) + 1;
|
||||
const length = text.length;
|
||||
shared.addErrorContext(onError, token.lineNumber,
|
||||
text, left, !left, [ column, length ]);
|
||||
if (line.indexOf(fullText) !== -1) {
|
||||
const text = fullText.trim();
|
||||
const column = line.indexOf(text) + 1;
|
||||
const length = text.length;
|
||||
shared.addErrorContext(onError, token.lineNumber,
|
||||
text, left, !left, [ column, length ]);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue