[FW][FIX] Cell: Fix detection of markdown links #3434
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The current regex of markdown link would purposely discard any
[label](link)
combination for which the label contained an opening bracket[
, the reason behind it was to reject strings for which the label itself contained a markdown link as the markdown spec [1] specifies that we capture square brackets immediately followed by parenthesis. However, we should still support a label that contains closed square brackets (e.g.[Label has [brackets]](link)
. Applying the proper rule to detect an exact link would be more costy than the current regex and considering that it will be called on all evaluated cell when reevaluated.Since the current regex is too restrictive, this revision relaxes it with the downside that it will now also capture strings that are technically not exact markdown links but better have false positive than false negatives. The regex also becomes simpler.
[1] https://spec-md.com/#sec-Links
Task: 3628780
Description:
description of this task, what is implemented and why it is implemented that way.
Task: : TASK_ID
review checklist
Forward-Port-Of: #3419
Forward-Port-Of: #3352