Fix heading auto-link hijacking nested link labels (#668) (#949)

* Fix heading auto-link hijacking nested link labels (#668)

* Refactor heading reference resolution to init-only state (#949)

---------

Co-authored-by: Alexandre Mutel <alexandre_mutel@live.com>
This commit is contained in:
dualfrozandAlexandre Mutel committed 2026-09-19 11:41:48 +02:00
1 parent 40eebc0cd8
commit 9006f0b4a2
6 files changed
+114 -1

No files matched your search

+12 -1
View File
@@ -34,6 +34,7 @@ public class LinkReferenceDefinition : LeafBlock
public LinkReferenceDefinition() : base(null)
{
IsOpen = false;
AllowResolutionInsideOpenLink = true;
}
/// <summary>
@@ -136,6 +137,16 @@ public class LinkReferenceDefinition : LeafBlock
/// </remarks>
public CreateLinkInlineDelegate? CreateLinkInline { get; set; }
/// <summary>
/// Gets whether this definition may resolve into a link while its label is
/// nested inside another still-open link or image bracket.
/// </summary>
/// <remarks>
/// <c>true</c> for user-authored definitions, preserving CommonMark's "links
/// cannot contain links". Implicitly generated ones can initialize it to <c>false</c>.
/// </remarks>
internal bool AllowResolutionInsideOpenLink { get; private protected init; }
/// <summary>
/// Tries to the parse the specified text into a definition.
/// </summary>
@@ -241,4 +252,4 @@ public class LinkReferenceDefinition : LeafBlock
public StringSlice UnescapedTitle;
public char TitleEnclosingCharacter;
}
}
}