alooshxl be4f5875a2 fix: exclude trailing punctuation from auto-detected links
URL auto-linking in text_to_parsed_content matched everything up to
the next space, so punctuation belonging to the surrounding sentence
became part of the link:

    (visit my website at https://example.com)
                                            ^ included in the URL

Trailing punctuation is now stripped following the same rules as
Markdown-style autolinks: sentence punctuation is excluded, and a
closing parenthesis is only kept when it is balanced by an opening
one within the URL, so links like
https://en.wikipedia.org/wiki/Crystal_(programming_language) stay
intact.

The URL pattern now also stops at angle brackets, and the text
around a link is split with a limit of 2 so a URL appearing twice on
the same line no longer drops the text after its second occurrence.

Closes #5300

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-13 16:23:41 +03:00
..