-
Notifications
You must be signed in to change notification settings - Fork 30
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
Try: Override callout shortcodes in favor of the notice block #337
Conversation
8ebbb24
to
b041a1f
Compare
Tried this in sandbox on https://make.wordpress.org/core/handbook/testing/automated-testing/phpunit/ and it breaks quite badly. I'm not sure what exactly, but seems to be do with content parsing. The page is very slow to load and looks like this when fully loaded: |
@adamwoodnz I had a quick look at this, and it appears that the |
b041a1f
to
29bf3db
Compare
I think the sanitization is still needed as the shortcode accepts users' input, but not so sure about the filter. So I've checked a bit if @dd32 I noticed that you have made several commits in the o2 plugin, so perhaps you have some thoughts on this. 🙂 |
Do we envisage this not being used on make.wp.org? Given it's a mu-plugin, it's probably best to keep the filters in there, since it would automatically be loaded anyway. You'd ideally check the occurrence of the legacy shortcodes too. |
The root cause is this line. Removing this filter directly resolves the issue. (i.e., comment out these three lines) Additionally, it also needs to remove the
Adv Admin landing page works correctly. @adamwoodnz I'll run a few more tests based on this tomorrow to see if there are no issues. It'd be nice if you could also take a look. The scope of this change seems quite extensive, it's great to have extra eyes to help check. |
The filter seems there for the plugin
Probably a dumb question. What does a legacy shortcode refer to there, any examples? But since the_content seems to be the root cause here, once it's removed, |
The ones being replaced by this code is what I was attempting to refer to 😄 |
84a0091
to
c7f3631
Compare
I realized that we cannot remove the 'the_content' filter, as this would lead to losing some features like auto-linking or small features like tooltips. Since earlier I placed the same content that's broken on production locally and it did not break, I guess that the problem might be on So eventually I just move $content outside the I guess the remaining task is first to convert the content that contains Reference: WordPress/wporg-developer#315 (comment) |
c7f3631
to
1c7a446
Compare
Created a test post https://developer.wordpress.org/redesign-test/2023/12/12/callouts/ Screenshots
|
This page is fixed, apart from the new line issue 🎉 @renintw what do you propose for the empty p tags, does this involve a lot of handbook editing? Some have the issue, others don't |
Colors and icons look great! Can the links be in blueberry and a border-radius of 2px be applied? The Figma design did not show links (that I can find), but we use blueberry in other similar content areas. |
There's an alert on https://make.wordpress.org/core/handbook/about/release-cycle/releasing-major-versions/ which isn't being captured for some reason The alert on https://make.wordpress.org/core/handbook/about/organization/ is ok though Trying some other handbooks and found https://make.wordpress.org/test/handbook/test-reports/ has on old style info box too |
Turns out these are both using I think we'll need to do a secondary PR to update styles for these in the Developer repo, as a short term fix before we add support for the GitHub markdown approach previously discussed. For these Make sites I'm not sure how concerned we should be about the inconsistency if we merge this. I don't think it's a major. Thoughts @ndiego @renintw ? |
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.
Works for me; tested on old and new Developer sites, Make Core, Make Test and Make Meta. One question above regarding inconsistencies with handbooks using callout markup rather than shortcodes.
Will all the Developer sites be consistent? |
Do you mean all the callouts/shortcodes on the Developer site? Not without further work for the Block Editor Handbook. I think our short term options are:
I think I prefer 1 as 2 feels like a backward step. Medium term I think we should push forward with the plan of using GitHub markdown and coverting that to Notice blocks. |
PR raised: WordPress/wporg-developer#429 |
It doesn't need a lot of editing on a single handbook post, but it would need a lot on all the posts.
We can write a regex to replace all the p tags inside the shortcode, and also starting from the second p tag, in addition to getting rid of it, we also need to add a new line before it. |
Thanks for opening the PR for it, 1 does make more sense than 2. |
I've changed the border-radius to For links color, they should've been blueberry, but somehow the styles here are applied, even though those actions have not been performed on links. Removing those pseudo-classes does make it render blueberry. Do you run into this as well @adamwoodnz? |
Yep same here. Shall we add a new |
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.
2 suggestions inline then I think we can merge this 👍
Huh, I see the problem now. It shouldn't have added |
Closes WordPress/wporg-developer#315
Remove the existing "callout" shortcodes, and replace them with the Notice block.
Some of the shortcode content can be very long

This shortcode is also used on classic themes, since it's part of the handbook code. I've updated the CSS to include fallbacks for the custom properties, so it should still work. For example, on make/core's handbook.
Is the sanitization + fitlering necessary? I grabbed it from the existing callout shortcode.