Ignore escaped backticks in code span elements per specification.

This commit is contained in:
David Anson 2017-03-13 21:29:24 -07:00
parent e2bdb522f5
commit 5a1fb40871
2 changed files with 16 additions and 4 deletions

View file

@ -958,14 +958,14 @@ module.exports = [
"aliases": [ "no-space-in-code" ],
"regexp": spaceInsideCodeRe,
"func": function MD038(params, errors) {
var inlineCodeSpansRe = /(`+)((?:.*?[^`])|)\1(?!`)/g;
var inlineCodeSpansRe = /(?:^|[^\\])((`+)((?:.*?[^`])|)\2(?!`))/g;
forEachInlineChild(params, "code_inline",
function forToken(token) {
var line = params.lines[token.lineNumber - 1];
var match = null;
while ((match = inlineCodeSpansRe.exec(line)) !== null) {
var inlineCodeSpan = match[0];
var content = match[2];
var inlineCodeSpan = match[1];
var content = match[3];
if (/^\s([^`]|$)/.test(content)) {
errors.addContext(token.lineNumber, inlineCodeSpan);
} else if (/[^`]\s$/.test(content)) {