-
Notifications
You must be signed in to change notification settings - Fork 33
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
Add possibility to have non void self closing HTML tags #123
Conversation
Hi, thank you for your contribution! I would like to do this slightly differently. When I created the formatter, However, as the author of I propose to add a configuration option named
|
Ah wait, this is about non void elements... in that case the current approach is fine, except that I would like to preserve the closing tag (self-closing or not) based on the source. With the current PR it will format Let's add the following option: /// Preferred style for closing tags (self-closing or not) when a non-void element has no children
closing_tag_style: ClosingTagStyle
// ...
enum ClosingTagStyle {
/// Preserve the original closing tag style (self-closing or a separate closing tag)
Preserve,
/// Self closing tag for elements with no children: `<div></div>` formats to `<div />`
SelfClosing,
/// Separate closing tag for elements with no children: `<div />` formats to `<div></div>`
NonSelfClosing,
} |
I think I fixed all the issues reported (except the macro, cf the discussion on that topic). I took the liberty to add some tests for the non closing style too, but commented those out while the macro topic is not resolved |
Everything should be good now, thank you very much for the feedback ! |
resolves #44
I added a parameter to enable/disable the feature. It is false by default but I can make it true.
Please tell me if I missed or should improve some things !