golang / go

The Go programming language
https://go.dev
BSD 3-Clause "New" or "Revised" License
123.91k stars 17.65k forks source link

spec: formatting of tables relies on fixed-width fonts #14234

Open fgergo opened 8 years ago

fgergo commented 8 years ago

On https://golang.org/ref/spec if you search for "array or slice" the table is not aligned as a table. I can't tell from this paragraph which is the 1st or the 2nd value in a range expression for different types.

(https://golang.org/doc/effective_go.html#for is clear on the range expression, though it's not the spec.)

mdempsky commented 8 years ago

Can you elaborate on what trouble you're having? It looks adequately table-aligned in my browser.

I believe the intended way to interpret that table is the line:

Range expression                          1st value          2nd value

array or slice  a  [n]E, *[n]E, or []E    index    i  int    a[i]       E

Then the way to understand that is for a for-based range loop like

for i, x := v { ... }

where v is of types [n]E, *[n]E, or []E, then the range values produced for i and x (respectively) will be an int-typed index and its corresponding E-typed element v[i].

ianlancetaylor commented 8 years ago

CC @griesemer

fgergo commented 8 years ago

Attached what I see on win7, latest chrome: range

bradfitz commented 8 years ago

Do you have some Chrome extension modifying your content? Or did you override the browser's monospace to be a proportional font?

fgergo commented 8 years ago

Sorry about that! I should have known better: it's highly improbable that the spec is not flawless on golang.org... I definitely set a wrong font somewhere.

mdempsky commented 8 years ago

Reopening just in case this is worth discussing further. The Go spec is maintained in HTML (not Godoc), so we could reasonably use actual <table> tags, etc. to make it more accessible to readers with less common setups (e.g., custom font settings, screen readers). Thoughts?

fgergo commented 8 years ago

(you most probably asked only the core team, though in case not: I - as a non-representative, acme user - never align with spaces.)

robpike commented 8 years ago

I agree that this should be formatted as an HTML table. I also think this is very low priority.

fgergo commented 8 years ago

noborder.html.txt