-
Notifications
You must be signed in to change notification settings - Fork 22.5k
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
HTML code style: No trailing slash, add note about prettier #20528
HTML code style: No trailing slash, add note about prettier #20528
Conversation
Preview URLsExternal URLsURL:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will only ask about it in our Editorial meeting to be sure, so meanwhile, I'm "Requesting changes" to be sure it is not merged by error.
I don't think there will be any opposition from the content peers, but we never now.
None from me - looks good - thanks @rubiesonthesky & @teoli2003 |
Thanks! |
I find it sad that the course of action here is to change MDN instead of changing Prettier. HTML permitting the no-op slashes means that the HTML spec doesn't ask people to waste time modifying their Appendix C-era markup, but I think the history of this aspect of the spec doesn't support the position of adding slashes as a matter of automated formatting. To the extent readers write code manually without the same tool, the slashes interact poorly with another HTML feature: unquoted attribute values (demo). Prettier itself doesn't trip over this: It adds a space before the slash and also adds quotes, even though either one would be sufficient. The result looks like what was needed to make Netscape 4 tolerate Appendix C, which makes the result have code smell of obsolete practices. Similar energy as recommending the "Web-safe" intersection of the Windows and Mac 256-color palettes. |
I think, maybe this should be considered again before taking Prettier actually in use with full force. There have been some confusion in issues (at least 1 issue, where it was not clear that Since browsers remove the trailing slashes from HTML when looking the code, I think maybe it would be better to not use them. But I think, maybe this should be discussion that should be opened in some visible place, so the decision would be found easily later on and there maybe could be wider arguments why / why not. Here is more discussion about this and link to relevant discussion in Prettier repository #21036 |
I think we better open a community discussion quickly before we have all valuable inputs scattered over PRs, and before people spending time and energy doing the same debate over multiple PRs. Ping @schalkneethling |
-> mdn/mdn-community#242 I hope I have done a reasonable job of capturing the issue there. |
Description
It seems that there was already comment about if the section is relevant or not.
This is not so clear change, but I feel it's highly confusing that there are "general guidelines" and then it's said that these only affect small subset of examples. When I first reading this page, it seemed to say that these general guidelines do not affect if you are just having snippet of code. This change can be dropped off from this PR, if it does not fit.