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

Unescaped HTML content found inside expression warning #25

Closed
chuygil opened this issue Feb 8, 2022 · 1 comment
Closed

Unescaped HTML content found inside expression warning #25

chuygil opened this issue Feb 8, 2022 · 1 comment

Comments

@chuygil
Copy link
Contributor

chuygil commented Feb 8, 2022

I recently upgraded to astro@next (0.23.0-next.2) and after starting the dev server I get the following warning:

*I am only using the <Icon /> component in my site

Unescaped HTML content found inside expression!

The next minor version of Astro will automatically escape all
expression content. Please use the `set:html` directive.

Expression content:
<path fill="currentColor" d="M22.46 6c-.77.35-1.6.58-2.46.69.88-.53 1.56-1.37 1.88-2.38-.83.5-1.75.85-2.72 1.05C18.37 4.5 17.26 4 16 4c-2.35 0-4.27 1.92-4.27 4.29 0 .34.04.67.11.98C8.28 9.09 5.11 7.38 3 4.79c-.37.63-.58 1.37-.58 2.15 0 1.49.75 2.81 1.91 3.56-.71 0-1.37-.2-1.95-.5v.03c0 2.08 1.48 3.82 3.44 4.21a4.22 4.22 0 0 1-1.93.07 4.28 4.28 0 0 0 4 2.98 8.521 8.521 0 0 1-5.33 1.84c-.34 0-.68-.02-1.02-.06C3.44 20.29 5.7 21 8.12 21 16 21 20.33 14.46 20.33 8.79c0-.19 0-.37-.01-.56.84-.6 1.56-1.36 2.14-2.23z"/>

I'm assuming this warning is coming from here right?

So once features from 0.23.0-next.2 are in the latest release the following can be changed in the Icon component:

From:

<svg {...props} astro-icon={name}>{title ? (<title>{title}</title>) : ''}{innerHTML}</svg>

To:

<svg {...props} astro-icon={name} set:html={innerHTML}>{title ? (<title>{title}</title>) : ''}</svg>

I could be completely misunderstanding this, but if not I would be happy to make these changes in the future!

@natemoo-re
Copy link
Owner

Fixed in astro-icon@0.6.0, which is going out now. Thanks!

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

No branches or pull requests

2 participants