Merge pull request #7170 from Lstarsky0/fix/link-target-balanced-parens

fix(tui): keep balanced parentheses in a markdown link's target
This commit is contained in:
Hunter Bown authored and GitHub committed 2026-11-01 03:48:43 +08:00
commit 9986831e95
1 file changed
+4 -1
+4 -1
View File
@@ -1854,7 +1854,10 @@ fn parse_inline_spans(line: &str, base_style: Style, link_style: Style) -> Vec<I
let text = &rest[1..bracket_end];
let after_bracket = &rest[bracket_end + 1..];
if after_bracket.starts_with('(')
&& let Some(paren_end) = after_bracket.find(')')
&& let Some(paren_end) = after_bracket
.match_indices(')')
.map(|(index, _)| index)
.find(|&index| has_unmatched_closing_delimiter(&after_bracket[1..=index], ')'))
{
let url = &after_bracket[1..paren_end];
// The runtime toggle gates backend emission, not layout.