-
Notifications
You must be signed in to change notification settings - Fork 78
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 issues with HTML entities #160
Conversation
4c86d7e
to
c65ad7a
Compare
335ebd3
to
3da0d51
Compare
225e254
to
d4ae347
Compare
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.
This seems to work well for newly created posts 🎉
I'm not sure what this is supposed to do in terms of migrating old versions of this block. Is it intended to fix old versions?
I'm doing the following:
- Move to
master
. npm install && npm run build
- Create a post, add the block, paste in the content, save.
- Load the frontend (see some characters not displaying properly).
- Switch to this branch.
npm install && npm run build
- Reload the frontend.
At this point, I see this:
And this:
And this:
Two things:
- The entities don't seem to be fixed in migration. Is that something that we should expect?
- The
<pre>
tags have been visibly added. They aren't removed until I open the block editor and save the post.
I don't think this is going to be fixable for existing blocks, because the solution requires a change to the markup (to add a |
Maybe I don't understand what the deprecation is supposed to do. I don't think I got a notice or anything when I upgraded, it just quietly changed the output of the block. I'm concerned that this will happen for our users too. |
That's the point, it's basically a compatibility tool to read block data from old versions, and use it seamlessly. I think there might be a way to fix the entities in old versions in the deprecation's migrate function, but it would be so overly complex that it's probably not worth pursuing. |
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.
Fix works well, code looks good
Fixes #152.
This was tricky as the browser's HTML parser kept converting HTML entities like
"
to"
. Fortunately, WordPress already solved this problem in their Code block, so this solution borrows from that.Testing Instructions