Help talk:Whitespace
![]() | This help page does not require a rating on Wikipedia's content assessment scale. It is of interest to the following WikiProjects: | ||||||||||
|
Spaces between text and comment
[edit]The section "Invisible comments", written by SchmuckyTheCat and Redrose64 in about 2011, tells editors to remove whitespace between text and an HTML comment (i.e invisible comment: <!-- This is an invisible comment -->) by "ensuring either that the initial < touches the text immediately beforehand, or that the final > touches the text immediately afterwards" because it could result in unwanted whitespace being added. It seems that inserting spaces between text and comments does not result in unwanted whitespace or at least not any more now in 2023. I feel that the entire section should be deleted or possibly be replaced by a text describing a case where adding whitespace between text and comment really results in the addition of unwanted whitespace if such a case still exists. With thanks and best regards, Johannes Schade (talk) 19:16, 25 August 2023 (UTC)
- You can't delete the whole section. This still produces whitespace if there are two newlines between text and a comment. This is extremely common when editors comment out a paragraph of uncited text.
- Templates interact in weird ways with leading and/or trailing comments. Leaving no spaces (especially a newline) at the beginning and end of a template is still good advice.
- There's no objective goal in removing this advice other than source beautification. Remember that Wikipedia isn't the only project that uses Wikipedia's source. Since this appears to be a change in MediaWiki behavior translating wiki source to html, we don't know the impact of this on other downlevel projects with different/older rendering engines. Best to leave the advice as is, rather than make the source look clean at the expense of the output looking dirty downstream.
- SchmuckyTheCat (talk) 00:56, 26 August 2023 (UTC)
- When I wrote this, the direct caution was against the markup that is: text, two newlines, a comment, two newlines and text. If you use markup like that, as here, you still get an extra-broad gap between paragraphs: the behaviour has not changed in twelve years. --Redrose64 đš (talk) 20:29, 26 August 2023 (UTC)
... the end of a paragraph. <!-- Don't use hidden comments in this manner --> The beginning of a paragraph ...