Update MD037/no-space-in-emphasis to ignore emphasis on code fences and not report violations for scenarios that span an empty code fence (fixes #381).

This commit is contained in:
David Anson 2021-08-22 15:28:28 -07:00
parent c0218b2489
commit c99ced2a7d
4 changed files with 35 additions and 4 deletions

View file

@ -78,11 +78,23 @@ module.exports = {
lineMetadata(),
(line, lineIndex, inCode, onFence, inTable, inItem, onBreak, inMath) => {
const onItemStart = (inItem === 1);
if (inCode || inTable || onBreak || onItemStart || isBlankLine(line)) {
if (
inCode ||
onFence ||
inTable ||
onBreak ||
onItemStart ||
isBlankLine(line)
) {
// Emphasis resets when leaving a block
resetRunTracking();
}
if (inCode || onBreak || inMath) {
if (
inCode ||
onFence ||
onBreak ||
inMath
) {
// Emphasis has no meaning here
return;
}