-
-
Notifications
You must be signed in to change notification settings - Fork 11
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
Fail to format conditional open/close tag pairs #97
Comments
You're right. It's too hard and complicated to solve. Out of the implementation, I personally discourage such code. This can't be easily understood, and neither Vue and Svelte nor other front-end template syntaxes support this case. |
Same, it's hard to grasp. But I tried running I was thinking maybe we could just output a text node in case there is incomplete HTML inside a if block ? That way we still validate the overall structure and ignore anything in these weird if blocks ? (but even that seems hard) |
That will be nice. |
Do you have any pointers about where I should look to do such change ? |
Maybe the parser. We can try parsing as normal elements, but fall back to text node if it fails. |
I'll try to find if I can figure this out, will keep you posted. Thanks |
Struggling a bit with this one, if you find some time to look at it, it would be awesome @g-plane |
markup_fmt
curently fails to parse when some opening / close html pair are conditional.This is not that uncommon, for example if you want to have an element that is conditionally collapsible, it would look like this, but it fails to parse:
With that you end up with one the the two following valid html snippets:
I've also seen this for conditional wrapping of inputs in a fieldset
Or conditional wrapping of input in a label tag (important for checkboxes interactivity for ex)
Same for conditional optgroup etc
More generally, if you want to wrap some html into another tag conditionally, you will end up with this issue.
I'm not sure how to solve this, any good ideas @g-plane ?
The text was updated successfully, but these errors were encountered: