Closed vaurdan closed 1 month ago
[!IMPORTANT]
Review skipped
Auto reviews are disabled on base/target branches other than the default branch.
Base branches to auto review (4)
* develop * add/.* * fix/.* * update/.*Please check the settings in the CodeRabbit UI or the
.coderabbit.yaml
file in this repository. To trigger a single review, invoke the@coderabbitai review
command.You can disable this status message by setting the
reviews.review_status
tofalse
in the CodeRabbit configuration file.
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
Description
This PR is in response to the #2669, where we want to prevent Smart Links from being suggested in unexpected blocks, such as headings or captions.
It introduces a new constant
BLOCKS_ALLOWED
in theSmart_Linking
class, which can be customized using the newwp_parsely_smart_linking_allowed_blocks
filter. This allows developers to specify which blocks are eligible for Smart Linking. Here's an example of how developers can customize the allowed blocks for the Smart Linking feature:The Smart Linking UI was also updated to respect these allowed blocks, and a utility function
isInsideHeadingOrCaption
was added to skip applying links within headings or captions.Motivation and context
How has this been tested?
Tested locally by verifying the filter for allowed blocks works as expected, ensuring Smart Links are not applied to inappropriate blocks or within headings or captions, and checking the UI for correct behavior with the new settings and adjustments.
Screenshots (if appropriate)
https://github.com/user-attachments/assets/4cf05edb-cae5-4c89-bb53-dbb04054ab0b