mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-16 22:10:13 +01:00
Use '\0' instead of ']' to allow end-of-block detection for single-line RegExp in getReferenceLinkImageData.
This commit is contained in:
parent
6934d24651
commit
fa0782d729
2 changed files with 6 additions and 6 deletions
|
|
@ -53,7 +53,7 @@ module.exports.orderedListItemMarkerRe = /^[\s>]*0*(\d+)[.)]/;
|
||||||
// Regular expression for all instances of emphasis markers
|
// Regular expression for all instances of emphasis markers
|
||||||
const emphasisMarkersRe = /[_*]/g;
|
const emphasisMarkersRe = /[_*]/g;
|
||||||
// Regular expression for reference links (full and collapsed but not shortcut)
|
// Regular expression for reference links (full and collapsed but not shortcut)
|
||||||
const referenceLinkRe = /!?\\?\[((?:\[[^\]]*]|[^\]])*)](?:(?:\[([^\]]*)\])|[^(]|$)/g;
|
const referenceLinkRe = /!?\\?\[((?:\[[^\]\0]*]|[^\]\0])*)](?:(?:\[([^\]\0]*)\])|[^(]|$)/g;
|
||||||
// Regular expression for link reference definitions
|
// Regular expression for link reference definitions
|
||||||
const linkReferenceDefinitionRe = /^ {0,3}\[([^\]]*[^\\])]:/;
|
const linkReferenceDefinitionRe = /^ {0,3}\[([^\]]*[^\\])]:/;
|
||||||
module.exports.linkReferenceDefinitionRe = linkReferenceDefinitionRe;
|
module.exports.linkReferenceDefinitionRe = linkReferenceDefinitionRe;
|
||||||
|
|
@ -809,8 +809,8 @@ function getReferenceLinkImageData(params, lineMetadata) {
|
||||||
lineOffsets[lineIndex] = currentOffset;
|
lineOffsets[lineIndex] = currentOffset;
|
||||||
if (!inCode) {
|
if (!inCode) {
|
||||||
if (line.trim().length === 0) {
|
if (line.trim().length === 0) {
|
||||||
// Close any unclosed brackets at the end of a block
|
// Allow RegExp to detect the end of a block
|
||||||
line = "]";
|
line = "\0";
|
||||||
}
|
}
|
||||||
contentLines.push(line);
|
contentLines.push(line);
|
||||||
currentOffset += line.length + 1;
|
currentOffset += line.length + 1;
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ const emphasisMarkersRe = /[_*]/g;
|
||||||
|
|
||||||
// Regular expression for reference links (full and collapsed but not shortcut)
|
// Regular expression for reference links (full and collapsed but not shortcut)
|
||||||
const referenceLinkRe =
|
const referenceLinkRe =
|
||||||
/!?\\?\[((?:\[[^\]]*]|[^\]])*)](?:(?:\[([^\]]*)\])|[^(]|$)/g;
|
/!?\\?\[((?:\[[^\]\0]*]|[^\]\0])*)](?:(?:\[([^\]\0]*)\])|[^(]|$)/g;
|
||||||
|
|
||||||
// Regular expression for link reference definitions
|
// Regular expression for link reference definitions
|
||||||
const linkReferenceDefinitionRe = /^ {0,3}\[([^\]]*[^\\])]:/;
|
const linkReferenceDefinitionRe = /^ {0,3}\[([^\]]*[^\\])]:/;
|
||||||
|
|
@ -831,8 +831,8 @@ function getReferenceLinkImageData(params, lineMetadata) {
|
||||||
lineOffsets[lineIndex] = currentOffset;
|
lineOffsets[lineIndex] = currentOffset;
|
||||||
if (!inCode) {
|
if (!inCode) {
|
||||||
if (line.trim().length === 0) {
|
if (line.trim().length === 0) {
|
||||||
// Close any unclosed brackets at the end of a block
|
// Allow RegExp to detect the end of a block
|
||||||
line = "]";
|
line = "\0";
|
||||||
}
|
}
|
||||||
contentLines.push(line);
|
contentLines.push(line);
|
||||||
currentOffset += line.length + 1;
|
currentOffset += line.length + 1;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue