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

Limit tags when rendering @html #10

Open
jimafisk opened this issue Jan 4, 2022 · 0 comments
Open

Limit tags when rendering @html #10

jimafisk opened this issue Jan 4, 2022 · 0 comments

Comments

@jimafisk
Copy link
Member

jimafisk commented Jan 4, 2022

In Svelte, variables are normally rendered as plain text, but you can render HTML using syntax like {@html expression} see more details and demo. It would be nice to be able to optionally limit which tags are allowed when rendering, for example:

<script>
	let string = "<p><em>this</em> string contains<br> some <strong>HTML!!!</strong></p>";
</script>

<p>{@html[strong, em] string}</p>

Output should look like this:

<p>this string contains<br> some HTML!!!</p>

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

1 participant