Skip to content
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

Fix escaping for shortcodes and URLs #177

Merged
merged 4 commits into from
Dec 17, 2020
Merged

Fix escaping for shortcodes and URLs #177

merged 4 commits into from
Dec 17, 2020

Conversation

yscik
Copy link
Contributor

@yscik yscik commented Nov 17, 2020

Fixes #176

Changes proposed in this Pull Request

  • Escape shortcodes in the PHP render callback with [[double_brackets]] syntax.
  • Remove escaping // in URLs. Haven't found a case where this would be need, and Syntaxhighlighter handles URLs, with the option to make them clickable

Testing instructions

@yscik yscik added this to the v3.5.6 milestone Nov 17, 2020
@yscik yscik requested review from jom and donnapep November 17, 2020 15:03
@yscik yscik mentioned this pull request Nov 17, 2020
@jom
Copy link
Member

jom commented Nov 17, 2020

This seems to fix the shortcode escaping issue, but it introduces a new issue with oembeds for URLs (see comment on original method).

For example, this code sample will output the <iframe...> on the frontend when placed in a code block:

[gallery ids="318,306,289"]

https://www.youtube.com/watch?v=21X5lGlDOfg

This line needs to be here so the end `</pre>` doesn't go on the YouTube line.

Produces this on frontend:
Screen Shot 2020-11-17 at 5 13 19 pm

@yscik
Copy link
Contributor Author

yscik commented Nov 18, 2020

Oh I missed that comment, thanks for the check! Looks like the oembed stuff runs before the block rendering, so I added the escaping back for block save, but restore the URLs in render_callback so links are displayed correctly: df35770

Copy link
Member

@jom jom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixes the issue and looks good.

@yscik yscik merged commit 3320601 into master Dec 17, 2020
@yscik yscik deleted the fix/escape-shortcodes branch December 17, 2020 17:35
@alexsanford alexsanford modified the milestones: v3.5.6, v3.6.0 Feb 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Brackets and protocol slashes remain escaped in output
3 participants