mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-09-22 05:40:48 +02:00
Update MD037/no-space-in-emphasis to ignore emphasis markers in link text/destination (refs #286).
This commit is contained in:
parent
0cea489e18
commit
37f1d6b64b
3 changed files with 38 additions and 8 deletions
10
lib/md037.js
10
lib/md037.js
|
@ -2,8 +2,8 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
const { addErrorContext, emphasisMarkersInCodeSpans, forEachLine,
|
||||
includesSorted, isBlankLine } = require("../helpers");
|
||||
const { addErrorContext, emphasisMarkersInContent, forEachLine, isBlankLine } =
|
||||
require("../helpers");
|
||||
const { lineMetadata } = require("./cache");
|
||||
|
||||
const emphasisRe = /(^|[^\\])(?:(\*\*?\*?)|(__?_?))/g;
|
||||
|
@ -66,7 +66,7 @@ module.exports = {
|
|||
return null;
|
||||
}
|
||||
// Initialize
|
||||
const ignoreMarkersByLine = emphasisMarkersInCodeSpans(params);
|
||||
const ignoreMarkersByLine = emphasisMarkersInContent(params);
|
||||
resetRunTracking();
|
||||
forEachLine(
|
||||
lineMetadata(),
|
||||
|
@ -89,8 +89,8 @@ module.exports = {
|
|||
while ((match = emphasisRe.exec(line))) {
|
||||
const ignoreMarkersForLine = ignoreMarkersByLine[lineIndex] || [];
|
||||
const matchIndex = match.index + match[1].length;
|
||||
if (includesSorted(ignoreMarkersForLine, matchIndex)) {
|
||||
// Ignore emphasis markers inside code spans
|
||||
if (ignoreMarkersForLine.includes(matchIndex)) {
|
||||
// Ignore emphasis markers inside code spans and links
|
||||
continue;
|
||||
}
|
||||
const matchLength = match[0].length - match[1].length;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue