Make it more ergonomic to comment HTML code
ctron opened this issue · 2 comments
Problem
It is not possible to ergonomically comment HTML code.
Steps To Reproduce
- Try to comment HTML code
Expected behavior
It should be easy as:
html!(
<div>
<!-- foo bar -->
</div>
)
Or:
html!(
<div>
{ /* foo bar */ }
</div>
)
In the latter variant, I would expect to comment to just disappear in the output HTML. In former version (<!--
) I could image to remove it as well, as it might be trouble updating the DOM tree, and doesn't add too much.
A workaround currently exists:
html!(
<div>
{ /* foo bar */ html!() }
</div>
)
Environment:
- Yew version:
0.19
Questionnaire
- I'm interested in fixing this myself but don't know where to start
- I would like to fix and I have a solution
- I don't have time to fix this right now, but maybe later
html!(
<div>
// foo bar
</div>
)
should work. Remember that the input to rust macros still gets processed by the rust lexer and produces a rust TokenStream. So rusty comments get thrown out before the macro even sees them.
Maybe I misunderstand and the bug is actually about getting comment tags into the output html, in that case, I don't have a quick solution ;)
Ah ok. So it is even easier as expected :) I does indeed work. So, maybe adding a section in the documentation about comments would be helpful.