-
Notifications
You must be signed in to change notification settings - Fork 453
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
weird, outlandish wrapping with HTML Pretty Diff #735
Comments
Indenting a tag in the HTML code source has no bearing on whether the HTML tag is a block or inline element. The two code samples above render to exactly the same output in the browser unless the CSS property
Both JS Beautify and Pretty Diff supply a wrap option. Set the value to 0 to turn wrapping off. No additional action will be taken on this issue from Pretty Diff. |
True. But that wasn't what I was asserting --- you have it backwards. Whether an HTML tag is a block or inline element should have a bearing on whether it is indented in the HTML source code.
Of course! I could format the source code any old way, and it would still show up in the browser. But the whole point of a code formatter is that I want my source code to look pretty, too! (Um, isn't this obvious? If you don't want to make the source code pretty, what is the point of the prettydiff library?)
(sigh) Just like js-beautify (see beautifier/js-beautify#841), it seems you are conflating the concepts of "do not format" and "not a block element". Phrasing tags such as |
The reason I indent even inline tags is to make the code easier to read. When tags are lumped into text they can get lost and become more difficult to quickly identify for human readers not using syntax color schemes. This is particularly true in long content that is not being wrapped. The goal is to make code easier to read opposed to increasing content legibility, which is where embedded inline elements would benefit. Content legibility is better discerned from the rendered product where various other pieces and interactions come together to influence how that content is consumed. I come to this conclusion because I have maintained an HTML/XML beautifier/parser for almost 7 years and at one time supported beautification as you suggest. Experience proved that to be less than ideal provided large blocks of time examining a variety of code samples and use cases.
From our perspectives, as the maintainers of large parsers, there is no difference. Code is parsed provided a set of rules. The parsed code is beautified according to a different set of rules. In the end there is only parsing and decoration. Everything else is completely superficial or irrelevant to the tools we maintain. What a given tag means or what it does to enhance and describe its content is for higher level assisting technologies not merely concerned with code beautification. Another option to consider in the face of a difference of opinion is to write your own beautifier if that difference of opinion is an insurmountable roadblock. That is how Lamborghini got started: A mere tractor producer recommended some improvements to Enzo Ferrari because the transmission felt a little sluggish. Enzo told him to go build his own car if he knew better. |
Thanks for the thorough and nice response.
Fine. You like that. I don't. We have different preferences. So all I ask is a setting that allows me to specify tags that should not start with a linefeed and be indented (i.e. inline). Isn't that a reasonable setting to ask for? An option of "don't format this at all" is a different setting semantically, don't you agree? |
Yes, sorry for taking up your time with this. The problem is that there are so many things for me to rewrite, because no one takes care in writing their software to specifications and they simply throw together a one-off solution that works specifically for their own situation. (Try getting a beautifier that understands the XML declaration in XHTML5 files, or that provides the correct EOL based upon the platform, for instance.) |
The formatting seems all over the place. If I use JS Beautifier for XHTML, it incorrectly indents the entire document except for the XML declaration, as I reported in #706. So atom-beautify passed the buck and said it was JS Beautifier's problem, and told me to use Pretty Diff instead.
So I did, and Pretty Diff is Pretty Ugly. I start with this:
Pretty Diff gives me this:
What? Since when is
<dfn>
a block element? If Pretty Diff is behind in HTML4, then surely it has never heard of HTML5.No, I don't intend to make special configuration files just to tell Pretty Diff that
<dfn>
should be inline. These sort of things are all over the place --- it's even wrapping<a>
. Useless.The text was updated successfully, but these errors were encountered: