-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Deprecate unescaped HTML inside of expressions #2489
Conversation
🦋 Changeset detectedLatest commit: cb50e61 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
✔️ Deploy Preview for astro-docs-2 ready! 🔨 Explore the source changes: cb50e61 🔍 Inspect the deploy log: https://app.netlify.com/sites/astro-docs-2/deploys/61f85cb2a7982f00079d71a8 😎 Browse the preview: https://deploy-preview-2489--astro-docs-2.netlify.app |
Is there really a point of referencing something that does not exist? It can always be added at a later date. |
@@ -41,4 +41,4 @@ if (content) { | |||
html = htmlContent; | |||
--- | |||
|
|||
{html ? html : <slot />} | |||
{html ? <Fragment set:html={html} /> : <slot />} |
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.
👍
459bb28
to
cb50e61
Compare
* feat: implement automatic escaping * feat: deprecate automatic escaping * fix: cast unescapeHTML as string * fix: slot fallback behavior * fix: unescaped content * Update escape.ts * Update escape.ts * feat: update internal components to use `set:html` * chore: update compiler * chore: update changeset
Changes
Does not require compiler changes!
Deprecates passing unescaped HTML inside of an expression (like
{"<style>div { color: red; }</style>"}
, logs a warning when unescaped HTML is encounteredDoes NOT enable automatic escaping inside of expressions! This is a simple toggle that can be enabled in a follow-up PR to be released in the next minor version.
Adds an internal
UnescapedString
primitive to powerset:html
and internal renderingTesting
Tested manually in the examples.
TODO: ensure all examples are working as expected.
Docs
TBD.