-
Notifications
You must be signed in to change notification settings - Fork 11
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
Shortcodes are evaluated instead of printed as text #668
Comments
My feeling is that the output that is generated by the plugin is then again run through I then tried to use the escaped Shortcode As a temporary remedy, inserting a simple replacement $content = str_replace( '[', '[', $content ); before if ( ! DEVELOPMENT_MODE ) {
set_transient( $transient_key, compact( 'content', 'attributes' ), MONTH_IN_SECONDS );
} in the plugin's |
Thanks for the report. I'm not sure why this is happening, as we're not applying You've also verified the issue happens when your shortcode plugin and this plugin are only active with a generic core theme? Is there any other plugin/theme that is causing the issue? |
Yes, all this is just with WP 6.1.1, the My feeling (see the details in my previous reply) is that the output is run through the default |
Ah, a Block theme. Can you try with an older theme, like Twenty Twenty One? |
Sure, just tested Twenty Twenty One, Twenty Twenty, Twenty Seventeen, and Twenty Ten. |
Sorry for the delay. I can reproduce the issue. This was also reported as an issue for Gutenberg in WordPress/gutenberg#13927 and fixed in WordPress/gutenberg#13996. The fix was for the block's
syntax-highlighting-code-block/syntax-highlighting-code-block.php Lines 609 to 613 in b42cac4
So as you suggest, re-encoding the special characters may be the solution. Nevertheless, it'll have to be careful to not accidentally encode any of the markup that highlight.php is generating. This may require doing two passes, first to replace all tags with placeholders, then do the entity encoding, and then replace the placeholders with the original tags. I'll give it a shot. |
Thanks for looking into this! I've been using that But something more robust than that |
I've got a PR open to address the shortcode problem in #696 |
This has been released on WordPress.org as part of v1.4.0. |
Great! Thanks, @westonruter! |
When adding a Shortcode to a core/code block, the Shortcode is printed as text instead of being evaluated (this is useful e.g. for documentation pages of a plugin's Shortcodes).
When then activating "Syntax-highlighting Code Block (with Server-side Rendering)" version 1.3.1 (tested on WP 6.1.1 and trunk), the Shortcode is however evaluated.
To reproduce this:
[test]
as the content.The text was updated successfully, but these errors were encountered: