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
x/tools/godoc: non-go file HTML rendering adds a leading tab, which can become visible #29568
Comments
As noted by @bradfitz, this doesn't seem to affect rendered .go files. There is no leading tab character inserted in HTML on pages like https://golang.org/src/net/http/server.go: It does affect other text files without an extension like https://golang.org/LICENSE, https://golang.org/AUTHORS, and files with non-go extension like https://golang.org/src/make.bash. |
The leading tabs were always there. The CSS change which caused this effect is golang/tools@4bc20fc#diff-62ab65160863cb8b1bd55a2653402fe4, which was made to fix another tab issue. Specifically, if I disable these 2 properties from style.css . * Ensure 8 characters in the document - which due to floating
* point rendering issues, might have a width of less than 1 each - are 8
* characters wide, so a tab in the 9th position indents properly. See
* https://github.com/webcompat/web-bugs/issues/17530#issuecomment-402675091
* for more information. */
display: inline-block;
width: 8ch; the leading space goes away, although the tab is still there in the html. /cc @bradfitz @dmitshur @andybons @kevinburke for decision. |
My guess is the tab was used for adding spacing. If no evidence otherwise can be found, I think we should remove it and implement spacing with a margin-right CSS property on @agnivade Where in the source code is that Thank you for investigating this issue, it is helpful. |
godoc/format.go - FormatText()
Correct. When rendering go files Let me know if removing |
Based on the history of events, I understand the tab character was used to ensure correct spacing. It's no longer needed and actively harmful after the change in golang/tools@4bc20fc. For that reason, and also because having it there makes copying the text harder (it includes a leading tab character not present in the source file), we should remove it. When removing it, we just need to check that various non-.go files render okay and that it doesn't cause any spacing issues. If it does, we should address those with CSS instead of a tab character. But after the change golang/tools@4bc20fc, I expect spacing to work well in all cases. /cc @kevinburke and @mvdan, who worked on that CL. Thanks @agnivade! |
Did some testing on several pages, with both Chrome and FF. Didn't see any issues. Will send the CL. |
Change https://golang.org/cl/160917 mentions this issue: |
The
CONTRIBUTORS
file does not have any leading whitespace on its lines. However, when viewed at https://golang.org/CONTRIBUTORS, the generated HTML adds leading whitespace (a single tab character):In most cases the tab character does not show visually up due to the way CSS is used to style content:
However, in some cases it becomes highly visible and distracting:
This does not affect the plain-text rendering mode of text files (e.g., https://golang.org/CONTRIBUTORS?m=text), only the HTML rendering.
The text was updated successfully, but these errors were encountered: