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

Unescape visible code tags in release-actions component #197

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

GaryJones
Copy link
Collaborator

The combination of the tagged template literal, and sprintf() in a placeholder, means that the <code> tags around the composer.json file name are visible in the release actions:

Screenshot 2022-11-12 at 01 09 25

While the most straightforward and sensible thing to do would be to just remove the tags / sprintf(), I tried to see if I could unescape them. There may be a simpler way than this messy and non-performant hack, that I stole from here.

It works though:

Screenshot 2022-11-12 at 02 02 38

This is the only instance in the code where a JS sprintf() call in a template literal is used with a replacement value that includes HTML that should be treated as HTML.

@bradyvercher
Copy link
Member

bradyvercher commented Nov 14, 2022

@GaryJones I guess I never noticed that before! This approach seems to strip the <code> tags out, though:

Screen Shot 2022-11-14 at 8 22 41 AM

I poked around in the Gutenberg source and something like this might work:

const copyPasteHtml = createInterpolateElement(
	__( 'Copy and paste into <code>composer.json</code>', 'satispress' ),
	{ code: createElement( 'code' ) }
);

@GaryJones
Copy link
Collaborator Author

Now updated:

Screenshot 2022-11-19 at 10 27 40

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants