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
|
||||
const emphasisMarkersRe = /[_*]/g;
|
||||
// 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
|
||||
const linkReferenceDefinitionRe = /^ {0,3}\[([^\]]*[^\\])]:/;
|
||||
module.exports.linkReferenceDefinitionRe = linkReferenceDefinitionRe;
|
||||
|
|
@ -809,8 +809,8 @@ function getReferenceLinkImageData(params, lineMetadata) {
|
|||
lineOffsets[lineIndex] = currentOffset;
|
||||
if (!inCode) {
|
||||
if (line.trim().length === 0) {
|
||||
// Close any unclosed brackets at the end of a block
|
||||
line = "]";
|
||||
// Allow RegExp to detect the end of a block
|
||||
line = "\0";
|
||||
}
|
||||
contentLines.push(line);
|
||||
currentOffset += line.length + 1;
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ const emphasisMarkersRe = /[_*]/g;
|
|||
|
||||
// Regular expression for reference links (full and collapsed but not shortcut)
|
||||
const referenceLinkRe =
|
||||
/!?\\?\[((?:\[[^\]]*]|[^\]])*)](?:(?:\[([^\]]*)\])|[^(]|$)/g;
|
||||
/!?\\?\[((?:\[[^\]\0]*]|[^\]\0])*)](?:(?:\[([^\]\0]*)\])|[^(]|$)/g;
|
||||
|
||||
// Regular expression for link reference definitions
|
||||
const linkReferenceDefinitionRe = /^ {0,3}\[([^\]]*[^\\])]:/;
|
||||
|
|
@ -831,8 +831,8 @@ function getReferenceLinkImageData(params, lineMetadata) {
|
|||
lineOffsets[lineIndex] = currentOffset;
|
||||
if (!inCode) {
|
||||
if (line.trim().length === 0) {
|
||||
// Close any unclosed brackets at the end of a block
|
||||
line = "]";
|
||||
// Allow RegExp to detect the end of a block
|
||||
line = "\0";
|
||||
}
|
||||
contentLines.push(line);
|
||||
currentOffset += line.length + 1;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue