-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
String literals are not allowed in html! macro #757
Comments
I actually like the strictness of not allowing string literals and keeping a separation between the DOM structure created and the "contents". Has this feature been requested lots? |
@mdtusz it hasn't, just wanted to document the request. It will likely be marked as |
I like the strictness and singular way to do things as they stand, but I do sometimes find it frustrating to not be able to copy+paste HTML from some external site (like some CSS framework guide showing how to use their classes) and instead have to meticulously wrap every bit of text in I don't think its too much of a problem if its implemented or not. |
I think it's important that html! {
<ul>
<li>List item
<li>Another list item
</ul>
} (yes, that is valid HTML5) Also, I think yew should recognize tags that HTML5 specifies to be self-closing (to make Maybe I should just implement this in a new proc macro crate 🤔 |
While If the desire is to be able to have pure input html, perhaps a |
Just my $.02, but sticking as closely as possible to JSX syntax is probably a very good thing given the broad adoption of the syntax... which means literal text should be allowed, and non-xml input would not be allowed. Along the same lines would be empty tag (fragment) support, in case you need it (such as for a dictionary list item).
|
Another minor detail I've recalled about this topic is that I believe that syn is much faster at parsing quote-delimited strings instead of arbitrary text tokens. |
I hadn't considered JSX. If it's also much more strict than HTML, that's a reason to be a little stricter as well.
I hadn't previously considered how |
@tracker1 fyi fragments like <>
<span>{"Yay!"}</span>
<span>{"Yew!"}</span>
</> already work! |
Closing this in favor of #1758 |
Description
Yew's
html!{}
macro deviates from JSX by not allowing text literals.Proposed Syntax:
Current Syntax
The text was updated successfully, but these errors were encountered: