-
Notifications
You must be signed in to change notification settings - Fork 898
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provide a filter to parse shortcodes #20812
Provide a filter to parse shortcodes #20812
Conversation
…orrect-analysis-results-when-parsing-shortcode
Pull Request Test Coverage Report for Build 6862911366Warning: This coverage report may be inaccurate.We've detected an issue with your CI configuration that might affect the accuracy of this pull request's coverage report.
💛 - Coveralls |
…orrect-analysis-results-when-parsing-shortcode
…orrect-analysis-results-when-parsing-shortcode
…orrect-analysis-results-when-parsing-shortcode
…ble. Otherwise, initiate a new Pluggable plugin. This is because in Elementor, pluggable is not available in the window
… watching the content retrieved from the main text editor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CR: Awesome work! 🏆 I've added some comments to address some cosmetic changes. I know that we reinstate the shortcode-plugin.js
file, so they're not on you, but I think it's a good chance to clean it up now so future maintainers will thank you later. Otherwise, the code looks great to me, and super nice find on the Insights tab. Am I correct that we could consider moving that into a separate PR?
packages/js/src/components/contentAnalysis/InclusiveLanguageAnalysis.js
Outdated
Show resolved
Hide resolved
Co-authored-by: Martijn van der Klis <martijnvanderklis@yoast.com>
…' of github.com:Yoast/wordpress-seo into 20801-incorrect-analysis-results-when-parsing-shortcode
…shortcodes for parsing to `Result.js`
…ysis-results-when-parsing-shortcode
We're currently only supporting shortcode parsing for posts, not taxonomies. Let's check how easy it is to support taxonomies as well. Test instructions need to be adapted slightly as we don't have the Images assessment for taxonomies (and we also don't have highlighting there). If it turns out to be too complex we can offload this to a separate IM issue. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mhkuu I had a look at the last two commits and I think the changes are all good! 🙌🏽 It's a good decision to move the logic for initializing Yoast shortcode plugin out of post-scrapper.js
. That way we avoid code duplication :)
ACC: We confirmed together things work as supposed! 🎉 |
Context
Per this PR: 20508 html parser change how and where shortcodes are removed #20528, we decided not to parse shortcodes that enter
Paper._text
for several reasons, namely:$shortcodes
global variable and the unparsed shortcodes insidePaper._text
.With this PR, we provide a filter to add an array of shortcodes that a user wants us to parse. Parsed shortcodes mean that we will include them in our analysis.⚠️ However, it must be noted that parsing the shortcodes means that it's highly likely that we won't be able to highlight text accurately, for the reasons mentioned above. For this reason, we disable/grey out the highlighting button when the shortcodes are parsed.
Summary
This PR can be summarized in the following changelog entry:
Relevant technical choices:
registerModification
API ofpackages/yoastseo/src/app.js
, which is a wrapper ofregisterModification
function of Pluggable plugin. Pluggable plugin takes care of plugin registrations, preloading and managing data modifications. (seepackages/yoastseo/src/pluggable.js
)packages/js/src/analysis/collectAnalysisData.js
), we apply the modifications that we previously registered. This includes the modification of the text/content where the shortcodes are parsed.Test instructions
Test instructions for the acceptance test before the PR gets merged
This PR can be acceptance tested by following these steps:
Add the shortcodes for testing
gallery
andsu_custom_gallery
to the shortcodes that are analyzed.Test in a post WITH shortcodes for parsing available
Add the shortcodes for testing
above.[gallery]
using the Text editorgallery
shortcode.Check the highlighting button
Add the shortcodes for testing
above.My cats are going crazy.
.Test in a post WITHOUT shortcodes for parsing available
Add the shortcodes for testing
above.Test in a taxonomy
🗒️ Note that highlighting is unavailable in taxonomies by default. Note that we also have no image assessments for taxonomies. So, we'll test a little bit differently:
Add the shortcodes for testing
above.[su_dummy_text]
from the Shortcodes Ultimate plugin.MyShortcodesFilter.js
and addsu_dummy_text
to the allowed shortcodes, so that it becomesshortcodes.push( "gallery", "su_custom_gallery", "su_dummy_text" );
.Relevant test scenarios
Test instructions for QA when the code is in the RC
QA can test this PR by following these steps:
Impact check
This PR affects the following parts of the plugin, which may require extra testing:
UI changes
Other environments
[shopify-seo]
, added test instructions for Shopify and attached theShopify
label to this PR.Documentation
Quality assurance
Innovation
innovation
label.Fixes #20801