go icon indicating copy to clipboard operation
go copied to clipboard

x/website: Usage of unicode double quotes in code blocks of the documentation

Open piroux opened this issue 3 years ago • 1 comments

What version of Go are you using (go version)?

Go 1.19

Does this issue reproduce with the latest release?

Yes

What did you do?

Read the current Go documentation website, for instance the Links section on the new Comments page

What did you expect to see?

Usage of the simple back quote character: `

  • is part of the Go comment syntax specification
  • translates to UTF-8 as \x60 (one byte)
  • https://unicode.link/codepoint/0060-grave-accent

What did you see instead?

Usage of double quote characters: and

  • are NOT part of the Go comment syntax specification
  • :
    • translates to UTF-8 as \xe2\x80\x9c (three bytes)
    • https://unicode.link/codepoint/201C-left-double-quotation-mark
  • :
    • translates to UTF-8 as \xe2\x80\x9d (three bytes)
    • https://unicode.link/codepoint/201D-right-double-quotation-mark

Context

I think that for a language that boasts itself to be very precise about Unicode, it should be very precise as what kind of backquotes / double-quotes it does render in its code-blocks example for the comment documentation, hence this issue. I am not sure if that is a problem yet, maybe only a discussion.

Here is what the page says about rendering quotes:

A pair of consecutive backticks (` U+0060) is interpreted as a Unicode left quote (“ U+201C), and a pair of consecutive single quotes (' U+0027) is interpreted as a unicode right quote (” U+201D).

Specific example

In the comment.md file, source for the Comment documentation page:

  • text-side: “[Text]: URL”
  • code-block: “[JSON and Go].”

piroux avatar Aug 05 '22 17:08 piroux

@rsc

thanm avatar Aug 08 '22 16:08 thanm

Usage of double quote characters: “ and ”

are NOT part of the Go comment syntax specification

As you have quoted, according to /doc/comment, a pair of consecutive backticks (U+0060) will be interpreted as a Unicode left quote (“ U+201C), and a pair of consecutive single quotes (U+0027) as a Unicode right quote (” U+201D). But it does not forbid to input the Unicode left and right quotes directly.

What did you expect to see?

Usage of the simple back quote character: `

The go doc comment page said nothing about using backticks to mark the opening and closing of an inline code span, although there does exist this type of usage in the doc comment sample:

it may embed the `Status` in the normal response to indicate the

But this sample is used to show a common mistake "not indenting a wrapped indented line of a list or code block". Thus I guess this sample are cited from some existing go doc comment, where the original author used backticks for inline code spans. This may not imply that Go endorses this usage.

weakish avatar Sep 16 '22 08:09 weakish