-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Unexpected Token Error: HTML escaped characters inside a code element with a js function #2924
Comments
An alternative would be to use a expression with template strings
|
I believe this is expected behavior and you're required to use either Assuming we wanted to change this and Svelte was to treat In my opinion, a big reason not to do it is that it wouldn't be very aligned with regular html behavior. A <code><script>alert(`your cookies: ${document.cookie}`)</script></code> However, if it's decided to keep the current behavior, we should definitely provide a better error. |
+1 for not changing the behavior here. Stuff inside a |
I'm ok with there being no change as well. It could be confusing if you have a bunch of javascript inside of a The issue I ran into was with using marked & codes blocks. https://github.com/ctx-core/ctx-core/blob/master/packages/markdown/svelte.js#L51-L70 At least this issue will be indexed by the search engine & a few good options will be presented to anybody who runs into this problem. |
I ran into this with mdsvex, it is a pretty simple process to just replace the curlies with the HTML entity in code blocks, especially with markdown since you pretty much always have access to the renderer for specific blocks. A custom It definitely shouldn't be considered a bug and 'fixed', people might want to output variables inside of code tags. |
Results with a
Unexpected token (3:15)
error.https://svelte.dev/repl/0ea02386ddd24db180db65422c4d0400?version=3.4.4
The text was updated successfully, but these errors were encountered: