Reimplement inlineCodeSpanRanges as codeBlockAndSpanRanges to fix an issue with unterminated code spans (and for flexibility).

This commit is contained in:
David Anson 2021-11-23 04:40:05 +00:00 committed by GitHub
parent 9c60343692
commit 1e82f76596
12 changed files with 178 additions and 71 deletions

View file

@ -3,7 +3,7 @@
"use strict";
const { addError, forEachLine, overlapsAnyRange } = require("../helpers");
const { inlineCodeSpanRanges, lineMetadata } = require("./cache");
const { codeBlockAndSpanRanges, lineMetadata } = require("./cache");
const reversedLinkRe =
/(^|[^\\])\(([^)]+)\)\[([^\]^][^\]]*)](?!\()/g;
@ -13,7 +13,7 @@ module.exports = {
"description": "Reversed link syntax",
"tags": [ "links" ],
"function": function MD011(params, onError) {
const exclusions = inlineCodeSpanRanges();
const exclusions = codeBlockAndSpanRanges();
forEachLine(lineMetadata(), (line, lineIndex, inCode, onFence) => {
if (!inCode && !onFence) {
let match = null;