Please have the html! macro accept html comments #3608
Replies: 1 comment 1 reply
-
The issue you're encountering with HTML comments in Yew's HTML macro is indeed a valid concern, as HTML comments are commonly used for documentation and code commenting purposes. While the current behavior might be intended for strict HTML compliance, it could be beneficial to consider enhancing Yew's HTML macro to handle HTML comments more gracefully. One potential solution could be to ignore HTML comment elements entirely within the macro and provide a warning to developers when encountering them, indicating that they are ignored and not included in the final HTML output. This approach would maintain clarity for developers and ensure that their comments are not inadvertently omitted from the rendered output. Additionally, requiring Rust-style comments (//) within the HTML context might feel unintended and counterintuitive for developers accustomed to working with HTML comments directly. |
Beta Was this translation helpful? Give feedback.
-
Hi, I'm new to yew, please go easy on me. I notice what I'd personally consider a flaw in the
html
macro. It is obviously up to the dev time if it's a flaw worth devoting time to. The compiler's feedback is 100% clear, so I wouldn't call it a bug, but I couldn't find a similar discussion or issue, so I felt it was important to open a dialogue on it.The following causes a hard error in yew
0.21.0
, as hosted oncrates.io
.Compile error:
Changing the comment to this is rejected the same by the compiler
Using a rust-style comment does however work in the way I'd expect a html comment to be treated.
It causes no compile errors, and the line is stripped from the output.
Naive suggestion:
What's anyone else's thoughts on this?
Beta Was this translation helpful? Give feedback.
All reactions